This is a migrated thread and some comments may be shown as answers.

Grid Client "RowSelecting" event

3 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
GoodLevitation
Top achievements
Rank 1
GoodLevitation asked on 21 May 2008, 03:31 PM
I have a grid and I set up the clientsetting, client events as shown beow

<

ClientEvents OnGridCreated="ScrollToRow" OnRowSelecting="RowSelectingHandler" />

Then in the java script function, I have as shown below.  And if I return "false", the code kept on processing.  I think it may be a bug.  In any case, I would like to stop processing, and how can I do it?  Thanks in advance...

function RowSelectingHandler(sender, eventArgs)
            {
                if (SCREEN_CHANGED)
                {
                    if (! confirm("Are you sure you want to move to a differnt row?" +
                        "\n\n" +
                        "You will loose any unsaved changes!" + "\n\n" +
                        "Press OK to continue, or Cancel to stay on the current row."))
                    {
                        return false;           
                    }
                  }
                return true;
            }

3 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 22 May 2008, 08:01 AM
Hello GoodLevitation,

You can cancel the event using:

eventArgs.set_cancel(true);

Regards,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
GoodLevitation
Top achievements
Rank 1
answered on 23 May 2008, 08:35 PM
Thank you Vlad.  This works.  and have a great weekend.
0
3v3
Top achievements
Rank 1
answered on 20 Jun 2010, 10:23 PM
I have a question????
I want to cancel the event if a parameter of my grid is true or false so I have find the parameter of a template but I think that the eventArgs I can´t get all the grid and  then search the value.

I amn´t sure this....

function RadGrid1_RowSelecting(sender, args) {
   var grid = sender;
   var MasterTable = grid.get_masterTableView();
   var row = MasterTable.get_dataItems()[args.get_itemIndexHierarchical()];
   var cell = MasterTable.getCellByColumnUniqueName(row, "TemplateColumn1");
   var show = cell.getElementsByTagName("input")[0].value;

           if(show .value == "0"){
              args.set_cancel(true);
           }
   }
I have done this but if I click the row to be false I lose all the selection.






Tags
Grid
Asked by
GoodLevitation
Top achievements
Rank 1
Answers by
Vlad
Telerik team
GoodLevitation
Top achievements
Rank 1
3v3
Top achievements
Rank 1
Share this question
or