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

Additional data after editing row

Hello Syncfusion Team,
I'm working with grid and UrlAdaptor.

@(Html.EJ().Grid<Aobject>("tb")
                        .Datasource(ds => ds
                                            .URL(Url.Action("Lista"))
                                            .InsertURL(Url.Action("Aggiungi"))
                                            .UpdateURL(Url.Action("Modifica"))
                                            .RemoveURL(Url.Action("Elimina"))
                                            .Adaptor(AdaptorType.UrlAdaptor)
                                    )
...

I want to add an additional information to the URL request (action "Lista") and I'm doing this with:

 function OnActionBegin(args) {
            this.model.query.addParams("data", new Date());
 }

It works fine, except when the user edit a row.
When the user changes the value of a cell and press enter, the grid call the "Modifica" action correctly. 

public JsonResult Modifica(object value)
{
...
return Json(true);
}

Then the grid automatically call the "Lista" action, but without the params.

How can I include my custom data in all calls to "Lista" action?

Thank you

3 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team March 28, 2016 08:56 AM UTC

Hi Omar,

Thanks for contacting Syncfusion support.

To get the custom data in all calls, we suggest you to use the query API. We can also pass the parameter in addParams property using query API.

Please find the code example and sample:


@(Html.EJ().Grid<object>("Grid")

         .Datasource(ds => ds.URL("/Home/DataSource").Adaptor("UrlAdaptor").UpdateURL("/Home/Update").InsertURL("/Home/Insert").RemoveURL("/Home/Delete"))

         .Query("new ej.Query().addParams('data', new Date())")

        .EditSettings(edit => { edit.AllowEditing().AllowAdding().AllowDeleting(); })

--------------------------------------------

public ActionResult DataSource(DataManager dm, DateTime data)

        {

            var DataSource = OrderRepository.GetAllRecords();

            DataResult result = new DataResult();

            result.result = DataSource.Skip(dm.Skip).Take(dm.Take).ToList();

            result.count = DataSource.Count();

            return Json(result, JsonRequestBehavior.AllowGet);
        }


Sample: http://www.syncfusion.com/downloads/support/forum/123532/ze/EJGrid-1184275223

Refer to the Help document for query API,

http://help.syncfusion.com/js/api/ejgrid#members:query

Regards,
Prasanna Kumar N.S.V



OM Omar Muscatello replied to Prasanna Kumar Viswanathan March 29, 2016 08:03 AM UTC

Hi Omar,

Thanks for contacting Syncfusion support.

To get the custom data in all calls, we suggest you to use the query API. We can also pass the parameter in addParams property using query API.

Please find the code example and sample:


@(Html.EJ().Grid<object>("Grid")

         .Datasource(ds => ds.URL("/Home/DataSource").Adaptor("UrlAdaptor").UpdateURL("/Home/Update").InsertURL("/Home/Insert").RemoveURL("/Home/Delete"))

         .Query("new ej.Query().addParams('data', new Date())")

        .EditSettings(edit => { edit.AllowEditing().AllowAdding().AllowDeleting(); })

--------------------------------------------

public ActionResult DataSource(DataManager dm, DateTime data)

        {

            var DataSource = OrderRepository.GetAllRecords();

            DataResult result = new DataResult();

            result.result = DataSource.Skip(dm.Skip).Take(dm.Take).ToList();

            result.count = DataSource.Count();

            return Json(result, JsonRequestBehavior.AllowGet);
        }


Sample: http://www.syncfusion.com/downloads/support/forum/123532/ze/EJGrid-1184275223

Refer to the Help document for query API,

http://help.syncfusion.com/js/api/ejgrid#members:query

Regards,
Prasanna Kumar N.S.V


Thank you Prasanna Kumar Viswanathan, problem solved!


PK Prasanna Kumar Viswanathan Syncfusion Team March 30, 2016 04:36 AM UTC

Hi Omar,

We are happy to hear that your issue has been resolved.

Please let us know if you need any further assistance.

Regards,
Prasanna Kumar N.S.V

Loader.
Up arrow icon