We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Prevent edit mode for doubleclick

Hi,
I have a Grid with edit on new page , I want to show Edit page on Toolbar Edit Click and show View Detail on DoubleClick.
This code not work , because DoubleClick calls the  GridRecordDoubleClick(args) function but later it calls the 
GridBeginEdit(args) function. How to prevent the edit mode for doubleclick ?

This is my code:

@(Html.EJ().Grid<AfroditeProPortal.DBModels.Centro>("Grid") 
      .Datasource(ds => ds.URL(@Url.Action("DataSource")).Adaptor(AdaptorType.UrlAdaptor)) 
      .Locale("it-IT")
      .AllowSorting()
      .AllowPaging()        
      .PageSettings(page => page.PageSize(15))
      .IsResponsive() 
      .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); }) 
      .ToolbarSettings(toolbar =>
      {
          toolbar.ShowToolbar().ToolbarItems(items =>
          {
              items.AddTool(ToolBarItems.Add);
              items.AddTool(ToolBarItems.Edit);
              items.AddTool(ToolBarItems.Delete);
          });
      }) 
      .Columns(col =>
      {
          col.Field(c => c.IDcentro).HeaderText("IDcentro").IsPrimaryKey(true).Width("15%").Add();
 
          col.Field(c => c.denominazione).HeaderText("Denominazione").Width("30%").Add();
          col.Field(c => c.indirizzo).HeaderText("Indirizzo").Width("35%").Add();
          col.Field(c => c.versioneSW).HeaderText("Ultimo collegamento").Width("20%").Add();
      })
 
 
      .ClientSideEvents(eve =>
      { 
          eve.ActionBegin("GridActionBegin"); 
          eve.BeginEdit("GridBeginEdit"); 
          eve.RecordDoubleClick("GridRecordDoubleClick");
 
      }))
function GridActionBegin(args) { 
           //pass external filter
           args.model.query.addParams("where", $('form').serialize());
       }

     function GridBeginEdit(args) {
          //toolbar event (edit)
          edit(args.rowData.IDcentro);
          args.cancel = true//cancel to prevent edit inline
      }
 
      function GridRecordDoubleClick(args) { 
          //double click event (view)        
          viewDetail(args.data.IDcentro); 
      }

     function edit(ID) {            
            window.location.rel='nofollow' href = 'Centri/Edit?IDcentro=' + ID;
        }
 
        function viewDetail(ID) {            
            window.location.rel='nofollow' href = 'Centri/Details?IDcentro='+ ID;
        }



3 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team June 1, 2017 08:37 AM UTC

Hi Nicola, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we suspect that you want to prevent record double click on editing in Grid. So, we suggest you to set false for allowEditOnDblClick property of ejGrid control. 

Refer the below code example. 


@(Html.EJ().Grid<OrdersView>("Editing") 
         
        -------------- 
 
        .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().AllowEditOnDblClick(false); }) 
        .ToolbarSettings(toolbar => 
        { 
            toolbar.ShowToolbar().ToolbarItems(items => 
            { 
                items.AddTool(ToolBarItems.Add); 
                items.AddTool(ToolBarItems.Edit); 
                items.AddTool(ToolBarItems.Delete); 
                items.AddTool(ToolBarItems.Update); 
                items.AddTool(ToolBarItems.Cancel); 
            }); 
        }) 
         
        .Columns(col => 
        { 
            ------------ 
 
        }) 
          
) 


Refer the help documentation. 



Regards, 
Thavasianand S. 



NI Nicola June 1, 2017 02:53 PM UTC

Thank you , it works perfectly

Regards,
Nicola


TS Thavasianand Sankaranarayanan Syncfusion Team June 2, 2017 06:32 AM UTC

Hi Nicola, 
 
We are happy that the problem has been solved. 
 
Please get back to us if you need any further assistance.  
 
Regards, 
Thavasianand S. 


Loader.
Up arrow icon