Hello community,I have searched a long time, but can't find a solution for it.I am loading a igtreegrid with a remote datasource (rest), i want to check some of the checkboxes when the data is loaded.For this i found some examples like this:
//Initialize $(".selector").igTreeGrid({ dataRendered: function(evt, ui) { $("#myTreeGridId_table").igTreeGridRowSelectors("toggleCheckStateById","my-id"); } });The problem seems to be that the dataRendered function is triggered to earl, no data is there to manipulate.When I use the "toggleCheckStateById" function in the chrome debugger it is working, and dataRender function is also triggered.What is the easiest way to check the checkboxes? Is there a way to pass the ids for some rows which should be checked? or is there a function which is called after the data is shown?I also tried already this event: rowsRenderedWith the some problem like dataRendered.Another thing is, i m loading the data on demand (AppendRowsOnDemand), I need also a trigger when this data is complete.I would be very thankful for each hintBest regards
Hello Michael,
Providing more detailed information on the way you initialize the igTreeGrid would be appreciated and would help me get to the root of the problem.
What features and grid options do you use and if it is possible - could you please post here your custom event handlers, or provide a code sample, so I could get a better idea of what you are doing in your code?
This way it would easier to help you resolve the issue you have.
Best Regards,
Vasil Pavlov
Associate Software Developer
Infragistics, Inc.
Hello Vasil Pavlov and thank you for the fast reply.Unfortunately this is not working for me, maybe I did something wrong.I tried the following code:
treeGrid.dataBound = function (evt, ui) { alert("TEST"); $("#treegrid_igTreeGridTable").igTreeGridRowSelectors("toggleCheckStateById", "00000000-0000-0000-0000-000000000000"); }
www.igniteui.com/.../ui.igtreegridrowselectors
{ enableCheckBoxes:
true
,
checkBoxMode:
"tryState"}
So i do not have a colKey, or is there one, or is it possible to set a colKey for it? Even if this is working I will still have the problem with order of the function calls.Best regards
Thank you for posting in our forum.
The API exposes the setCellValue method that could be used to set a new value to a given cell – you could use it to check the checkboxes you want. More information may be found here:
https://www.igniteui.com/help/api/2017.2/ui.iggridupdating#methods:setCellValue
Loading the remote data is an asynchronous operation and the time needed for it to finish may vary. That’s why the grid renders itself first, and then fills in the data, once it gets it from the remote endpoint.
Instead of dataRendered, you could use the igTreeGrid dataBound event, which gets fired after data binding is complete. Inside its callback you have a reference to the dataSource and could check to see if the data was loaded.
The igTreeGrid doesn’t support AppendRowsOnDemand, but it inherits it from the igGrid, so please note that if you use it, some unexpected behavior or issues may occur.
If you need any additional assistance, feel free to contact me.