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

EjDialog Disappears After Opening from Custom Toolbar Button

Hello,
I would like to open a Dialog form with some data from a selected row in a grid.
This is the code:
//GRID
@(Html.EJ().Grid("ContractLocationsGrid")
.Datasource(ds => ds.Json((IEnumerable)Model.ContractLocations.ToList()).UpdateURL("../NormalContractLocationUpdate").InsertURL("../NormalContractLocationInsert").RemoveURL("../NormalContractLocationDelete").Adaptor(AdaptorType.RemoteSaveAdaptor))
.EditSettings(edit =>
{
edit.AllowAdding().AllowDeleting().AllowEditing();
})
.Locale("it-IT")
...
.ClientSideEvents(eve =>
{
eve.ActionBegin("ContractLocationActionBegin");
eve.EndAdd("endContractLocationAdd");
eve.EndDelete("endContractLocationDelete");
eve.RecordClick("onContractLocationRecordClick");
eve.Load("onContractLocationsGridLoad");
eve.QueryCellInfo("onQueryCelInfo");
eve.Create("ContractLocationsGridCreate");
eve.ToolbarClick("ContractLocationsToolBarClick");
})
)
//DIALOG
@{Html.EJ().Dialog("locationForm").Title("Dati Postazione").IsResponsive(true).Containment(".popup-content-box").ContentTemplate(@

Inserire i dati della postazione

Codice

*


Livello

*


Categoria

*


Titolo

*


Codice

*

Descrizione Breve

*

Descrizione

*


@Html.EJ().Button("saveBtn").Type(ButtonType.Button).Size(ButtonSize.Medium).Height("30").Width("100").Text("Salva").ClientSideEvents(s => s.Click("maplocationformsubmit"))
).EnableModal(true).EnableResize(false).Width(291).ClientSideEvents(evt => evt.Close("onDialogClose")).IsResponsive(true).Render();}
function ContractLocationsToolBarClick(sender) {
if (sender.itemName == "WorkLocationsSync")
{
...
}
else if (sender.itemName == "WorkLocationsPutOnMap")
{
...
$("#locationForm").ejDialog("open");
}
}
The problem is that when I click on the custom toolbar button the dialog form opens but then it closes immediatly.
Where is the problem?
Thanks.
Claudio

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team August 22, 2017 08:30 AM UTC

Hi Claudio, 

Thanks for contacting Syncfusion support. 

According to your requirement we suspect that you need dialog editing in Grid. When we set EditMode as Dialog it will edit data using a dialog box, which displays the fields associated with the data record being edited. 
 
For more information refer the below help document.  
 
 
For your convenience we have created a sample and please download the sample from the below link. 
 
Find the code example:  
 
 
@(Html.EJ().Grid<object>("FlatGrid") 
    .Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.dataSource).UpdateURL("CellEditUpdate").InsertURL("CellEditInsert").RemoveURL("CellEditDelete").Adaptor(AdaptorType.RemoteSaveAdaptor)) 
    .AllowPaging() 
    .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Dialog); }) 
    ------------------- 
     
     .Columns(col => 
      { 
         col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Add(); 
         col.Field("CustomerID").HeaderText("Customer ID").Add(); 
         col.Field("EmployeeID").HeaderText("Employee ID").ValidationRules(v => v.AddRule("number", true).AddRule("range", "[0,23.59]")).Add(); 
         col.Field("Freight").HeaderText("Freight").Add(); 
      }) 
   ) 
 
Screenshot:  
 
 
 

If we misunderstood your query, please get back to us. 

Regards, 
Prasanna Kumar N.S.V 



Loader.
Up arrow icon