I have validation on some cells in a grid which cause an alert to pop up based on certain rules. After the alert pops up, I can get the focus to go back to the cell in question, but I never can get the cursor to blink. I have to hit F2 to get the cursor back, or click on the cell itself.
Basically I need to see the cursor blinking in the validated cell AFTER the user chooses OK on the javascript alert popup window.
I currently have this code after the javascript alert pops.
mygrid.selectCell(rId,columnId,false,true,edit,true);
mygrid.editCell();
Which seems to keep the focus on the cell in question. However no matter what cominations I try with the selectCell function, nothing seems to get the cursor or “force edit” the cell. I have read many of the posts on this forum about how to do this, and have tried numerous of these fixes to no avail.
I have tried:
mygrid.selectCell(rId,columnId,false,true,edit,true);
mygrid.selectCell(rId,columnId,false,true,true,true);
mygrid.selectCell(rId,columnId,false,true,false,true);
mygrid.selectCell(rId,columnId,false,true,true,false);
mygrid.selectCell(rId,columnId,true,false,false,true);
mygrid.selectCell(rId,columnId,true,false,true,true);
etc etc etc etc
Thanks for any help with this.
Not sure about exact reason of problem in your case, but most probably it time concurrency - you are executing editCell command in moment when current cell is not fully closed yet.
Please check attached sample, it shows how concurrency can be resolved.
1195566470.ZIP (56.6 KB)
OK - what you have supplied activates the cell BELOW the one I am validating, after the user presses OK on the alert box, and yes, the cursor is blinking on the below cell. But I need the cell that was validated to have a blinking cursor instead.
So I tried this:
mygridFC.selectCell((rId-1),(cellInd));
mygridFC.editCell();
Because the (rID-1) gives me the row I want. It works great! HOWEVER… now when I navigate using my arrow keys, and get a validation alert, after saying OK to the alert, the cell becomes uneditable, and I get an error as follows:
Error: ‘this.cell’ is null or not an object.
It pertains to this line in dhtmlxgrid.js:
this.cell.className=this.cell.className.replace(“editable”,"");
Apparently by selecting the row above, I’ve messed with the arrow key functionality and now my object doesn’t exist. Help?
Please beware that in attached sample I used
mygrid.selectCell(mygrid.getRowIndex(id),ind);
Such conversion as ID-1 is not the best way, while it may work in your case, it is logically incorrect.