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.

Additional data after editing row

Thread ID:

Created:

Updated:

Platform:

Replies:

123532 Mar 27,2016 08:56 AM Mar 30,2016 12:36 AM ASP.NET MVC 3
loading
Tags: Grid
Omar Muscatello
Asked On March 27, 2016 08:56 AM

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

Prasanna Kumar Viswanathan [Syncfusion]
Replied On March 28, 2016 04:56 AM

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


Omar Muscatello
Replied On March 29, 2016 04:03 AM

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!

Prasanna Kumar Viswanathan [Syncfusion]
Replied On March 30, 2016 12:36 AM

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

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.

;