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

QueryBuilder ODataV4

Hello,

Is it possible to use the query builder with a DataManager based on an ODataV4 DataAdapter?

If, yes, what should I set the dataSource of the query builder to in JSX?

Currently I have a Grid whose DataSource is bound to the data manager. Everything is fine on that side. 

When I add the query builder with the datasource set to the same one as the grid, it dosen't show up (the query builder). On the console I get the following error
     adaptors.js:600 Uncaught TypeError: Cannot read property 'indexOf' of undefined
    at ODataV4Adaptor.UrlAdaptor.processQuery (adaptors.js:600)
    at DataManager.executeLocal (manager.js:143)
    at QueryBuilderComponent.QueryBuilder.render (query-builder.js:2901)
    at QueryBuilderComponent.render (querybuilder.component.js:54)
    at QueryBuilderComponent.Component.appendTo (component.js:185)
    at QueryBuilderComponent.ComponentBase.renderReactComponent (component-base.js:94)


When I set the dataSource to null it shows up but when the ruleChange event fires and try the same code as your public demo(although with a different set of columns) Iget 2 errors. The first's stack tract is : 
Uncaught TypeError: Cannot read property 'toJson' of null
    at ODataV4Adaptor.UrlAdaptor.processQuery (adaptors.js:524)
    at DataManager.executeQuery (manager.js:200)
    at Data.executeQuery (data.js:467)
    at Data.insert (data.js:449)
    at Data.getData (data.js:439)
    at Render.refreshDataManager (render.js:224)
    at Observer.<anonymous> (render.js:130)
    at Observer.notify (observer.js:131)
    at GridComponent.ComponentBase.trigger (component-base.js:198)
    at Render.refresh (render.js:97)
    at GridComponent.Grid.refresh (grid.js:2329)
    at QueryBuilderComponent.ListComponent.queryBuilderRuleChange (ListComponent.js:131)
    at Observer.notify (observer.js:127)
    at QueryBuilderComponent.ComponentBase.trigger (component-base.js:198)
    at QueryBuilderComponent.QueryBuilder.filterRules (query-builder.js:2249)
    at QueryBuilderComponent.QueryBuilder.updateRules (query-builder.js:2233)
    at QueryBuilderComponent.QueryBuilder.changeValueSuccessCallBack (query-builder.js:1177)
    at Observer.<anonymous> (query-builder.js:1168)
    at Observer.notify (observer.js:109)
    at QueryBuilderComponent.ComponentBase.trigger (component-base.js:198)
    at QueryBuilderComponent.QueryBuilder.filterValue (query-builder.js:1167)
    at QueryBuilderComponent.QueryBuilder.changeValue (query-builder.js:1150)
    at Observer.notify (observer.js:127)
    at TextBox.Base.trigger (base.js:184)
    at TextBox.inputHandler (textbox.js:531)

The second's stacktrace is :

adaptors.js:524 Uncaught TypeError: Cannot read property 'toJson' of null
    at ODataV4Adaptor.UrlAdaptor.processQuery (adaptors.js:524)
    at DataManager.executeQuery (manager.js:200)
    at Data.executeQuery (data.js:467)
    at Data.insert (data.js:449)
    at Data.getData (data.js:439)
    at Render.refreshDataManager (render.js:224)
    at Observer.<anonymous> (render.js:130)
    at Observer.notify (observer.js:131)
    at GridComponent.ComponentBase.trigger (component-base.js:198)
    at Render.refresh (render.js:97)
    at Observer.notify (observer.js:127)
    at GridComponent.Component.notify (component.js:265)
    at GridComponent.Grid.onPropertyChanged (grid.js:1210)
    at GridComponent.Base.dataBind (base.js:124)
    at GridComponent.Component.dataBind (component.js:211)
    at messageHandler (util.js:42)

Can you help with this?

3 Replies

MV Madhan Venkateshan Syncfusion Team November 20, 2019 05:25 PM UTC

Hi Raouf, 
 
Thanks for contacting Syncfusion support. 
 
We have checked your query and we cannot able to reproduce the reported issue. We have prepared a sample based on ODataV4 DataAdapter for both querybuilder and grid, please check with below sample to resolve the issue at your end, If the issue still persist, could you please replicate the issue in the attached sample link. 
 
 
 
Regards, 
Madhan V 



RA raouf November 29, 2019 08:35 AM UTC

Hello,

Thank you for you answer.

The problem is now solved. 

It seems it was caused by incompatible versions between the required ones required to make this work.

After cleaning the node_modules folder, the query builder works fine.


MV Madhan Venkateshan Syncfusion Team December 2, 2019 05:08 AM UTC

Hi Raouf, 
 
Thanks for you update. 
  
We are happy to hear that your reported issue has been resolved. Please feel free to contact us if you need any further assistance on Syncfusion components. 
  
Regards, 
 Madhan V

Loader.
Live Chat Icon For mobile
Up arrow icon