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.
Unfortunately, activation email could not send to your email. Please try again.

Prevent edit mode for doubleclick

Thread ID:

Created:

Updated:

Platform:

Replies:

130760 May 31,2017 01:21 PM Jun 2,2017 02:32 AM ASP.NET MVC 3
loading
Tags: Grid
Nicola
Asked On May 31, 2017 01:21 PM

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;
        }



Thavasianand Sankaranarayanan [Syncfusion]
Replied On June 1, 2017 04:37 AM

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. 


Nicola
Replied On June 1, 2017 10:53 AM

Thank you , it works perfectly

Regards,
Nicola

Thavasianand Sankaranarayanan [Syncfusion]
Replied On June 2, 2017 02:32 AM

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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;