jQWidgets Forums
jQuery UI Widgets › Forums › TreeGrid › How to clear child TreeGrid after selecting row in main TreeGrid
Tagged: refresh, treegrid, virtualmode
This topic contains 2 replies, has 2 voices, and was last updated by lvLokkie 8 years, 7 months ago.
-
Author
-
September 8, 2016 at 8:13 am How to clear child TreeGrid after selecting row in main TreeGrid #87184
Hello, my name is Ivan. Sorry for my English
Config: JQuery 1.11.3, jQWidgets v4.1.2 (2016-Apr), PC, Chrome 52.0.2743.116 m (64-bit)I have a problem with implementation of my logic. There are two TreeGrids, which dependent on each other. Each grid configured at VirtualMode
virtualModeCreateRecords: function (expandedRecord, done) { console.log(expandedRecord); var dataAdapter = new $.jqx.dataAdapter(self._source, { autoBind: true, virtualmode: true, formatData: function (data) { // checking expandedRecord exists or not return self._addFilterData(data, expandedRecord); }, loadError: function (xhr) { console.log(xhr); new Notification(Notification.ERROR, "Не удалось получить ответ от сервера").show(); }, loadComplete: function (data) { if (data) { var reply = new Reply(); $.extend(reply, data); if (reply.hasMessages()) { reply.showAllMessages(); } if (reply.result) { var container = reply.result.container; if (!self._source.totalrecords) { self._source.totalrecords = parseFloat(container.totalRows); } done(dataAdapter.records); } else { done(false); } reply.redirect(); } else { new Notification(Notification.ERROR, "Не удалось получить ответ от сервера").show(); done(false); } } }) }, virtualModeRecordCreating: function (record) { if (record.c_childrens_count == 0) { record.leaf = true; } }
and etc.
When i select row in upper TreeGrid, lower grid must be reloaded. It works, but not fully. Lower grid cleared after expanding row at lower grid and selection row at upper. After that, lowergrid stop working and stay cleared always;
TreeGridView.prototype.refresh = function (parentSelectedRowId, onViewRefreshed) { if (this._data_adapter) { this.container.jqxTreeGrid('clear'); // joval - parameter, which connect two grids this._data_adapter._source.data.joval = parentSelectedRowId; this._data_adapter.dataBind(); if (onViewRefreshed && typeof onViewRefreshed == 'function') { onViewRefreshed.call(this); } } else { throw new Error('Не заданы данные для обновления jqxTreeGrid'); } };
Thank you, waiting for your answer very much.
September 8, 2016 at 10:19 am How to clear child TreeGrid after selecting row in main TreeGrid #87192Hello lvLokkie,
I would like to ask you about virtual mode, are you sure to need to load data on that way (This is useful when load bigger data source).
You have too much external and additional libraries, it is difficult to trace what happen.
Could you provide some data to do tests (it will be better to provide us an working example in jseditor or in fiddle)?Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comSeptember 12, 2016 at 7:57 am How to clear child TreeGrid after selecting row in main TreeGrid #87267Hristo, thank you for your answer. Problem solved. I used destroy and recreaction of TreeGrid with saving selected rows.
-
AuthorPosts
You must be logged in to reply to this topic.