Action method is not receiving the parameter added in the ej-grid action-begin method


Hi Support:

I defined the ej-grid as follows:

  <ej-grid id="grid" 
                     allow-paging="true"
                     template-refresh="refreshTemplate" action-complete="complete" action-begin="begin"  >
                   <e-datamanager url="/Home/DataSource" adaptor="UrlAdaptor"></e-datamanager>

                <e-columns>
               ....
                </e-columns>
           
            </ej-grid>


Then the script is:


 function begin(args)
        {
            args.model.query.addParams("age", 30);
      
        }

The DataSource action method is invoked but the age parameter is 0.

What could be missing here.

Thanks in advanced


David

3 Replies

SA Saravanan Arunachalam Syncfusion Team February 2, 2017 01:07 PM UTC

Hi David, 
Thanks for contacting Syncfusion’s support. 
The cause of the issue is you have recieved the additional parameters on the server side as a separate parameter and we suggest you to received both DataManager and additional parameter as a single object. Please refer to the below code example and screenshot. 
<ej-grid id="FlatGrid" allow-paging="true" action-begin="begin"> 
    <e-datamanager url="Home/DataSource" adaptor="UrlAdaptor"></e-datamanager> 
     . . . 
</ej-grid> 
<script type="text/javascript"> 
    function begin(args) { 
         
        args.model.query.addParams("age", 30); 
    } 
     
</script> 
public IActionResult DataSource([FromBody]Test dm) 
        { 
          . . . 
        } 
        public class Test :DataManager 
        { 
            public int age { get; set; } 
        } 
 
 
  
We have created a sample that can be downloaded from the below link. 
Regards, 
Saravanan A. 



DS dsapo February 2, 2017 03:35 PM UTC

Hi Saravanan:


Thanks for the precise answer as always.

Regards,

David 


SA Saravanan Arunachalam Syncfusion Team February 3, 2017 04:27 AM UTC

Hi David,  
Thanks for your update.            
We are happy that the provided information helped you. 
Regards, 
Saravanan A. 


Loader.
Up arrow icon