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

Grid EJ 2, DataManager with "offline: true" and a custom parameter which is ignored

Hi,

I'm using JS 2 version 16.1.0.37 in  javascript (no typescript).

I have a datamanager and a grid using it:   
 
            var data = new ej.data.DataManager({
                url:  ...,
                adaptor: new ej.data.WebApiAdaptor(),
                headers: requestHeaders,
                offline: true
            });

           var grid = new ej.grids.Grid({
                dataSource: data,
                query: new ej.data.Query().addParams('ModuleId', moduleId),
                ....
                ....

Problem: when I include the "offline: true" in the DataManager, my 'ModuleId' parameter isn't being sent to the server. Actually, no parameter at all is being sent.
When I comment out the   "offline: true", I see some parameters being sent, including my 'ModuleId' parameter.
Example: /?$inlinecount=allpages&params=[object%20Object]&ModuleId=452&$skip=5&$top=5
This is what I see in the browser's dev tools (XHR JSON Panel):
GET Parameters:
{
"$inlinecount": "allpages",
"params": "[object%20Object]",
"ModuleId": "452",
"$skip": "0",
"$top": "5"
}

How can I send my 'ModuleId' parameter and use the 'offline: true' setting to let the grid handle sorting, etc. all by its own at client side? Is this a bug? 

2nd question: what is the [object%20Object] parameter? All these parameters except 'ModuleId' have been auto-generated. 

3rd question:
I'm having globalization & localization problems too (I cannot make it work). Please see my post at this thread:  https://www.syncfusion.com/support/forums/javascript/general/133194

Thanks!






5 Replies

DR Dhivya Rajendran Syncfusion Team June 1, 2018 12:39 PM UTC

Hi Horacio, 

Thanks for contacting Syncfusion support. 

Query1 : How can I send my 'ModuleId' parameter and use the 'offline: true' setting to let the grid handle sorting, etc. 
 
By default, When you applied offline mode as true in data manager, it get the all the remote data at the initialization and make the action process in the client side this is default behavior. If you want to share the additional parameters in every grid action then you will disable the offline mode in data manager. 
 
Kindly refer to the below help documentation link for more information. 
 
If you want to pass the additional parameters after setting offline mode means you can pass the query parameters as data manger second arguments. 
Kindly refer to the below code example for more information. 
var data = new ej.data.DataManager({ 
    url: 'https://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/Products', 
    adaptor: new ej.data.WebApiAdaptor(), 
    crossDomain: true, 
    Offline: true, 
}, new ej.data.Query().addParams('ModuleId', "1")) 
var grid = new ej.grids.Grid({ 
    dataSource: data, 
    allowPaging: true, 
    columns: [ 
        { field: 'ProductID', headerText: 'Product ID', textAlign: 'Right' }, 
        { field: 'ProductName', headerText: 'Product Name', width: 170 }, 
        . . . . 
    ], 
    pageSettings: { pageCount: 5 } 
}); 
grid.appendTo('#Grid'); 
 
 
Query 2: what is the [object%20Object] parameter? All these parameters except 'ModuleId' have been auto-generated 
 
We have checked your query and we are able to reproduce the reported problem. We have considered “ Invalid parameters are generated while using addParams in data manager” as a defect and logged a report for the same. The fix will be available in any of our upcoming release. 
 
Query 3: I'm having globalization & localization problems too. 
 
We have checked the link, its related to the Essential JS1 post. Could you please refer the below help documentation link for more information on using localization in EJ2 Grid. 
 
 
Regards, 
R.Dhivya    



HO horacioj June 1, 2018 06:40 PM UTC

Thanks, Dhivya. 
The DataManager parameter is now working fine. Regarding the globalization/localization I'm still pretty much clueless. I've created a new thread (with the questions . problems), to make it easier to find for someone else: 



PS: I see a problem in the bootstrap.css theme ("16.1.0.37\Web (Essential JS 2)\JavaScript\dist\bootstrap.css").
Removing the 'heigh' from .e-pagerdown seems to solve the problem.



DR Dhivya Rajendran Syncfusion Team June 4, 2018 12:51 PM UTC

Hi Horacio, 

Thanks for your update. 
Could you please provide the below details or more information regarding your problem, it will be helpful for us to provide a better solution as soon as possible. 

  1. Check whether the parent container CSS will affect the Grid container or not ?
  2. If you are using custom CSS in Grid then share your custom file too.
  3. Share your browser details whether the reported problem occurred in all browsers or in specific browser.


Could you please share pager dropdown element CSS details for further analysis. 

 
 
Regards, 
R.Dhivya 



HO horacioj June 4, 2018 08:43 PM UTC

It happens when 'the' bootstrap.css isn't referenced. The EJ theme depends on it apparently, at least for this dropdown.

Thanks! 


DR Dhivya Rajendran Syncfusion Team June 5, 2018 01:07 PM UTC

Hi Horacio, 

Thanks for your update. 
We have validated the provided information, By default our Essential JS2 components are not depended with any other third party configuration.  If you still face the reported problems in your application then provide more details for further analysis. 

Our team updated their response for the below forum. Please check the update for the below forum. 
 
 
Please get back to us if you need further assistance. 
Regards,
R.Dhivya 


Loader.
Live Chat Icon For mobile
Up arrow icon