Dropping onto different cell type

I have 2 grids both enabled for drag/drop. Unfortunately, the column order and types are different between each grid. Column 1 in grid1 is a string, and column 1 in grid 2 is a date. When an object from grid1 is dropped onto grid2 it shows NaNNaNNaN… in column 1 of grid2. I have written some code in the onDrop event to send data back to my server which in turn updates grid2 and shows it correctly, but that couple seconds of NaNNaNNaN… looks rather bad. Is there any way to get around this?


grid2.attachEvent("onDrop", function(sId,tId,dId,sObj,tObj,sCol,tCol){});

to check if dropped value is valid.

S. docs.dhtmlx.com/doku.php?id=dhtm … ent_ondrop

Its not that I want to check the validity of the dropped object. The problem is that the grid I am dropping into is formatted differently. As I said before, column 1 on grid1 is a string. Column 1 on grid2 is a date. Actually, this is a custom eXcell that converts unixtime into a readable format. I’m guessing that when I drop the object it is trying to run the string through my eXcell and due to the datatype it cant.

I guess the best way I can think to deal with this is to check the data in the eXcell and if there’s a string being processed show nothing or the word “pending”. I’m not sure what else can be done.

Let me recapitulate:
Grid1.Column1 is a string…
Grid2.Column1 is a date.
You will make a drag’n drop from Grid1.Column1 => Grid2.Column1 but when you do this you get a “NaNNaNNaN”.

My proposed solution:

grid2.attachEvent("onDrop", function(sId,tId,dId,sObj,tObj,sCol,tCol){});

Sorry, i can’t see your problem. Why you can’t the dropped value from Grid1.Column1 into a valid date in the function above?

grid2.attachEvent("onDrop", function(sId,tId,dId,sObj,tObj,sCol,tCol){
    var droppedValue = grid1.cells(sId,sCol).getValue();
    var strDate = new Date();

Isn’t possible?

Thank you for the suggestion, but I’m sorry this does not work for me. I changed it a little bit. My data coming from XML contains unixtime for Grid2.Column1 and as I said I have an eXcell to format it to a human readable value. So I modified your suggested event handler to output unixtime as well. In the eXcell I added a line to alert out the value being passed. Unfortunately, it is still the string contained in Grid1.Column1 which is a file name.

grid2.attachEvent("onDrop", function(sId,tId,dId,sObj,tObj,sCol,tCol){ var droppedValue = grid1.cells(sId,sCol).getValue(); var strDate = new Date(); strDate = strDate * 10; this.cells(tId,tCol).setValue(strDate); });

According to the documentation, onDrop occurs after the drop finishes. So my filename string is dropped, then run through the eXcellformater and outputs NaN because it can not format it into a date. Then with your suggested code it changes it to a date. Theoretically I can see this working, but its just not fast enough and I’m afraid my users will see NaN and wonder.

I still think In my case I will have to modify my eXcell to look at the type being passed before it tried to format it.