In a grid with a row selected, if a user clicks on another row, is there a way of
cancelling the selection in javascript ? Like in the BeforeRowActivateHandler ?
Thanks
Hello,
The UltraWebGrid has a BeforeRowActivateHandler and a BeforeSelectChangeHandler <both on the Client Side Events list> that you can handle and plug in the javascript necessary to accomplish this task... something like:
var MyCondition = 0;
function UltraWebGrid1_BeforeSelectChangeHandler(gridName, id){
MyCondition += 1;
if (MyCondition > 2) {
return true;
}
I appreciate this response but as the original poster says, there is a lot of information missing from the documentation and even this answer. I'm finding that the documentation does not tell you the trickiness of handling this event. Your code for example has this MyCondition variable - 'what on earth is that for?' one might ask. I'm finding the event fires twice, once with an id of blank to deselect the currently selected row. Regardless of whether I return true or false from this, the event gets fired again with the id populated with the id of the row about to be selected. So in order to truly cancel the event I have to rig up something like what you have in your code so that I can cancel the event twice. In my case I needed to prompt the user to see if they wanted to save changes before permitting the row change so I had to program to avoid the message coming up twice also.
Sam.
Matthew Kraft"]Hello, The UltraWebGrid has a BeforeRowActivateHandler and a BeforeSelectChangeHandler <both on the Client Side Events list> that you can handle and plug in the javascript necessary to accomplish this task... something like: var MyCondition = 0; function UltraWebGrid1_BeforeSelectChangeHandler(gridName, id){ MyCondition += 1; if (MyCondition > 2) { return true; } }
2 remarks:
1) searching for the 3 words: cancel row select doesn't return this thread. Searching for: cancelling row selectdoes find this thread. Maybe the search algorithm could be improved a little...
2) I have read in different places (including from Infragistics employees, thread 651) that to cancel a client side event, you use things like "return false;" or "event.returnValue = false;". But here it seems that to cancel the row select, you have to return true. Where is this documented? The help file certainly doesn't specify this in an obvious way.
regards,Thierry