I tried to adapt this code used with some previous Telerik libraries...
...but Kendo doesn't like the '$rows().each'. Can someone point me in the right direction?
19 Answers, 1 is accepted
prmGridId? I have grid not defined errors.
The only thing I can think to do is attach a call to this function to the onclick handler for the expand arrow on each master row, so that it fires before the ExpandDetailRow event.
So I've had to go for a more direct route: when a detail row is expanded I disable the expanding of any other detail rows:
There is a detailCollapse event you could bind a function to, then from that function you could call:
off('click');to remove all bindings, or you could call a grid refresh from it:To just repaint the grid.
var grid = $('#grid').data('kendoGrid');
I have modified your function to that is shown below, it now expands and collapses the rows with the same button.
call the function like:
using the DetailExpand event
I use the function above to expand/collaps the grid rows. But it will collapse/expand ALL the rows in the grid instead of the rows on the current page (I use paging).
Is it possible to collapse only the rows on the selected page?
Forget my reply, it does only the current page, it only takes a lot of time (I have 100 rows).
Please have in mind that expanding 100 rows is very resource consuming operation as it will have to create a 100 new widgets. The performance also greatly depends on the browser and the used machine.
In this scenario, I can suggest using paging to the Grid to reduce the number of rows to expand.
This will also require to slightly change the expand logic to affect only the current page. This can be achieved by retrieving the current page and the current pageSize:
Many thanks, very clear!