Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by T. Rietz on Jan 15, 2009 04:27
open dhtmlx forum
DHTMLGrid error on selectRow()

Hello,

on my browser occurs an error while grid.selectRow(1) or grid.selectCell(1,1) with the
following message in FF:
>> r is undefined
>>
>> if (r._childIndexes)var c = r.childNodes[r._childIndexes[cInd]];else

the code snippet:

mygrid = new dhtmlXGridObject('customergrid_container');
mygrid.setImagePath("/JS/codebase/imgs/");
mygrid.setColumnIds"id,customer_name,customer_contact,customer_street,customer_zip,customer_city,customer_email,customer_tel1pre,customer_tel1num,customer_faxpre,customer_faxnum");
mygrid.setHeader(",Kunde,Ansprechpartner,Straße, PLZ,Ort, E-Mail,Tel,telnum,Fax,faxnum",null,["color: red","color: gray","color: #00cc00","color: #000099","color: #000099","color: #00cc00","color: #00cc00","color: #00cc00","color: #00cc00","color: #00cc00","color: #00cc00"]);
mygrid.setInitWidths("20,210,130,130,40,65,*,35,50,35,50");
mygrid.setColTypes("ro,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed");
mygrid.setColSorting("na,str,str,str,str,str,str,str,str,str");
mygrid.setSkin("modern");
mygrid.enableAutoWidth(true)
mygrid.enableAutoHeigth(true);
mygrid.enableLightMouseNavigation(true);
mygrid.objBox.style.overflowX="hidden";
mygrid.init();
mygrid.loadXML("/cgi-bin/medium.pl?action=loadXMLCustomer");

mygrid.selectRow(1);

What I'm doing wrong?
Thanks in advance,
T. Rietz
Answer posted by Support on Jan 15, 2009 07:14
xml loading is async, which means that command executed next to the loadXML will be executed in moment of time when data is not really loaded in grid yet.
To fix code you need to use onXLE event or second parameter of loadXML as

mygrid.loadXML("/cgi-bin/medium.pl?action=loadXMLCustomer",function(){
               mygrid.selectRow(1);
});

Answer posted by T.Rietz on Jan 15, 2009 08:15
Hello,

Thank You for the fast reply. The described solution works fine. But how can I
achieve to switch prompt in the edit modus of (i.e.) cell 2 of a just added row?

Thanks in advance,
T. Rietz


Answer posted by Support on Jan 15, 2009 08:18
You can use 
   mygrid.selectCell(row_ind,cell_ind); //select cell in grid
   mygrid.editCell(); //switch it to edit state
Answer posted by T. Rietz on Jan 15, 2009 08:26
Hello,

Thanks. But on my machine occurs the same error like the one in my first question described.
That's my problem.

With greetings,
T. Rietz
Answer posted by Support on Jan 15, 2009 09:40
If command executed after XML loading (as was described above ) - it must not cause any problems.
If issue still occurs for you - please provide any kind of sample where problem can be reconstructed ( you can send it directly to support@dhtmlx.com