Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Voxyn on Oct 16, 2008 06:19
open dhtmlx forum
Error type: Cell; Row not exists

I have posted the following error in response to a question but am not able to find it anymore. So here my question again with some source code:
I am using a grid to build a routing for a production software. I loads the data from XML using php to generate it:
This is how my grid is initialized:

    mygrid = new dhtmlXGridObject('gridbox');
    mygrid.enableDragAndDrop(true);
    mygrid.enableMultiselect(true);
    mygrid.setDragHandler(dragEvent);
    mygrid.attachEvent("onRowDblClicked",dblClickEvent);
    mygrid.attachEvent("onXLE",grid_offsetter(false));
    mygrid.attachEvent("onXLS",lock(false));
    mygrid.setOnRowSelectHandler(rowSelectEvent);
    mygrid.setImagePath("./jscript/dhtmlXGrid/codebase/imgs/");    
    mygrid.loadXML("feed_lib_routers.php?lot_id="+lot_id);
    mygrid.init();

The XML returns about 10 columns and sometimes with 200 rows including embedded html (loading time up to 10 sec). This is no problem to display and everything with drag and drop works.

My problem is, that in some cases clicking on a row results in the error "Error type: Cell; Description:Row not exists". But since the row is there to click it I don't know why this happens. In my earlier post you mentioned that the loading of the data and the init process may not be completed but I checked this and the error seems to occur randomly.
Question:
Is there a way to get an event that fires when the grid is fully initialized and ready to use?

Thanks,

Christoph
Answer posted by Support on Oct 16, 2008 08:25
Such error occurs when some code creates cell object , but uses not existing coordinates of cell. 
The most common reason of such problem 
- non unique IDs in grid 
- usage of grid's API with incorrect rowId or incorrect rowIndex

Please check the code of rowSelectEvent - it possible that some command in it use incorrect data in API calls. 
Also, latest version of dhtmlxgrid.js 1.6 sent by email, it has some minor fixes to related functionality and may resolve your problem as well. 
Answer posted by Voxyn on Oct 16, 2008 08:34
The only thing rowSelectEvent does, is to assign the current selected row(s) into a global variable
to handle multiple row ids. This is to get better overview in the code (using multiple_ids instead of mygrid.getSelectedId())

function rowSelectEvent(rowId,cellId)
    {
        multiple_ids = mygrid.getSelectedId();
    }

Mail did not contain an attachment.

Thank you,

Christoph
Answer posted by Support on Oct 16, 2008 09:34
>>The only thing rowSelectEvent does, is to assign the current selected row(s) into a global variable
This is can't cause the error for sure

>>Mail did not contain an attachment.
Probably some kind of mail filtering software. We will resend it once more, if it will miss attachment again - please contact us directly at support@dhtmlx.com and provide any alternative email address.
Answer posted by Voxyn on Oct 20, 2008 05:20
I received the mail with the attached new version of the js file.
The bug with the cell not found is now fixed. Thanks for that!
Now I have a new problem with this version:
The following code is used to retrieve the order of the rows in the grid
for(i=mygrid.getRowsNum()-1;i>=0;i--)
 {
...
            router_order+=mygrid.cells(mygrid.getRowId(i),14).getValue()+";";
..
 }
I use drag and drop functionality to change the order but with the new version the order of the grid returned by this loop
is the one being loaded via XML. The movement of the rows is not visible. I don't use any filter or sorting inside my grid.
I read about a similar issue in the knowledge base but am not sure if this is a bug of the grid or of my code because it was
working with the earliert version.
Answer posted by Support on Oct 20, 2008 08:42
The fixed file is sent by  email (try to use it instead of the original).
Answer posted by Voxyn on Oct 20, 2008 09:43
Fix is working. Great support, thank you!