Access specific detail grid to update model attributes

1 Answer 46 Views
Grid
Chris
Top achievements
Rank 1
Chris asked on 22 Feb 2023, 03:49 PM | edited on 22 Feb 2023, 03:49 PM

The following code works when I have one detail grid expanded. If I have multiple grids expanded, it only executes against the first detail grid. I am having trouble figuring out how to determine which grid is selected and execute the below code against that particular detail grid:


if (count === 0) {
	_.each($('.tst-k-grid').data("kendoGrid")._data, function (e) {
		if (e.Status !== 'E') {
			e.Status = 'W';
		}
	});
} else if (count > 1) {
	_.each($('.tst-k-grid').data("kendoGrid")._data, function (e) {
		if (e.Status !== 'E') {
			e.Status = 'X';
		}
	});
}

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 27 Feb 2023, 10:28 AM

Hello Chris,

Is there any error message in the console when you run this script?

You need to ensure all child Grids have been rendered and bound to their data source before executing the logic of updating the model. To do so You can execute the logic inside the child Grids' dataBound event handler:

         $('.tst-k-grid').each(function(i, el) {
                $(el).data("kendoGrid").bind("dataBound", function(e) {
                  var data = e.sender._data
                  console.log(data)
                })
              })

Dojo demo: https://dojo.telerik.com/aFIDiNiy

Let me know if this helps yo resolve the situation.

Regards,
Nikolay
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or