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; } }
Hello Sam,
samuelburns said:Your code for example has this MyCondition variable - 'what on earth is that for?' one might ask.
When coding an if statement one must have some condition to determine if you wanted to cancel the selection change otherwise how do you perform a decision in code? If your scenario does not allow any selection change at all then you can actively omit that conditional check and simply return true. If there was any misunderstanding because of my conditional check I apologize.
It looks to me like Developer Support should become involved in your scenario and see what is going on with the WebGrid when you want to cancel the selection of a row, they can be contacted here. It could be the version of the NetAdvantage WebGrid you are using or the result of other factors and we should see what is truly happening here.