Categories | Question details Back To List | ||
grid.sortRows(...) results in TypeError: this.rowsBuffer[i] has no properties Hi, I'm building dhtmlXGridObject and loading data from XML. When page got refreshed by action of user and a row is now missing in new XML I got alert TypeError: this.rowsBuffer[i] has no properties. No need to say that the sorting will not take place :( Row ids remain the same after refresh. Only the deleted row is missing. code: var grid = new dhtmlXGridObject('someId'); var header = 'col1, col2'; grid.setHeader(header); grid.setInitWidths("300,*"); grid.setColSorting("str,str"); grid.setColTypes("ro,ro"); grid.init(); var xmlContent = 'someXML'; grid.parse(xmlContent); grid.sortRows(0, "str", "asc"); // error occurred here grid.setSortImgState(true, 0, "asc"); Thanks for help Peter Answer posted by dhxSupport on Apr 21, 2009 07:15 This issue occurs because of not all rows was rendered. You should call sortRows method only after all rows was loaded. To detect if all rows was loaded you can use "onXLE" event (availible at PRO version) or 2nd parameter of load() method. As you are using parse method the only way to call command after grid was loaded is to use "onXLE" event: grid.attachEvent("onXLE",function(){ grid.sortRows(0, "str", "asc"); // error occurred here }) Answer posted by Peter Melus on Apr 21, 2009 07:40 I tried what you suggested before in somewhat different way and now again your code exactly but i still got the same error :( My guess is that for some reason the grid is still trying to sort the row it does not have. What leads me to this is the fact that both your and mine solution works fine when I add row or refresh the page without removing any row. FYI: We are using dhtmlxSuite_2009Rel1_pro_90226 this version Do feel free to contact me for more information if you need them. Peter Answer posted by dhxSupport on Apr 21, 2009 07:50 Could you please provide us sample where we can reproduce this issue? You can send it directly to the support@dhtmlx.com Answer posted by Peter Melus on Apr 21, 2009 09:30 Hi, When I was preparing some page to send you I found the problem ... The XML that I was sending from server did not have its total_count decreased :( <rows pos="0" total_count="203">.....</rows> Now everything works fine ;) Thank you for your effort. Peter |