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
close icon

Send parameter - JS grid

I am trying to send parameter when request data for the grid:

$("#Grid").ejGrid({
dataSource: dm,
allowScrolling: true,
allowVirtualScrolling: true,
filterSettings: {
filterType: "menu"
},
query: new ej.Query().addParams("id", 23),
allowFiltering: true,
scrollSettings: { width: "auto", height: 300, allowVirtualScrolling: true, virtualScrollMode: ej.Grid.VirtualScrollMode.Continuous },
pageSettings: { enableQueryString: true, pageSize: 10 },
columns: [
{ field: "data", headerText: "Data", isPrimarykey: true },
{ field: "value", headerText: "Value" },
]
});
and the action:
public JsonResult Get([FromBody]DataManager dm, [FromBody]string id)
{...
, I see the request with id 23 is send to the server, but when I debug on the server id is null.
You can see in the sample.

Attachment: SyncfusionASPNETCoreWebApplication1_3556037a.rar

1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team September 6, 2017 05:39 PM UTC

Hi Sir, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we are able to reproduce the reported issue from the provided sample. 

We have already discuss about the above mention query in the following Knowledge base. 


Refer the below code example. 

[Site.js] 

$("#Grid").ejGrid({ 
    dataSource: dm, 
    allowScrolling: true, 
 
     --- 
 
    pageSettings: { enableQueryString: true, pageSize: 10 }, 
    columns: [ 
        { field: "value", headerText: "ID", isPrimarykey: true }, 
        { field: "data", headerText: "Email" }, 
    ], 
 
    actionBegin: function (args) { 
 
        args.model.query.addParams("ID", 10248); 
    } 
 
}); 
 
---------------------------------------------- 
[HomeContrller.cs] 

        public class Test : DataManager       //inherit the class to show age as property of DataManager 
        { 
            public int ID { get; set; } 
        } 
        public IActionResult Get([FromBody]Test dm) 
        { 
            var data = new[] 
                { 
                     
                  --- 
 
                }; 
 
            IEnumerable Data = data.ToList(); 
            DataOperations operation = new DataOperations(); 
             
             --- 
 
            return Json(new { result = Data, count = count }); 
        } 


Refer the below screenshot. 

 

We have modified the sample and it can be downloadable from the below location. 


Refer the help documentation. 


Regards, 
Thavasianand S. 


Loader.
Live Chat Icon For mobile
Up arrow icon