Skip to content

Convert the boolean tree generated by DevExpress Data Grid to a more structural format, so it can easily parsed by server side languages

License

Notifications You must be signed in to change notification settings

ahmad-moussawi/devexpress-filter-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevExpress boolean filter express tree converter

npm version

Implementing server side operations with DevExpress DataGrid (or to be more specific DataStore) is required when dealing with large data sets.

DevExpress supports OData store by default.

But if you want to write your own custom store, parsing the filter expression generated by DevExpress is not an easy task, since the filter data structure is not static, and can have multiple structures, dealing with it on strongly typed language like Java or C# can be cumbersome.

This tiny library transform the filter tree to a more structural format, that can be parsed easily in a server side language.

It have no dependencies at all, just some lines of JavaScript code.

Some examples

from

[
    "name", "=", "hello"
]

to

{
 "left": "name",
 "op": "=",
 "right": "hello"
}

from

[
    ["name", "=", "hello"],
    "and",
    ["last_name", "=", "value"],
]

to

{
 "booleanOperator": "and",
 "conditions": [
  {
   "left": "name",
   "op": "=",
   "right": "hello"
  },
  {
   "left": "last_name",
   "op": "=",
   "right": "value"
  }
 ]
}

from

[
    ["name", "=", "hello"],
    "and",
    ["last_name", "=", "value"],
    "or",
    ["age", ">", 20],
]

to

{
 "booleanOperator": "or",
 "conditions": [
  {
   "booleanOperator": "and",
   "conditions": [
    {
     "left": "name",
     "op": "=",
     "right": "hello"
    },
    {
     "left": "last_name",
     "op": "=",
     "right": "value"
    }
   ]
  },
  {
   "left": "age",
   "op": ">",
   "right": 20
  }
 ]
}

About

Convert the boolean tree generated by DevExpress Data Grid to a more structural format, so it can easily parsed by server side languages

Resources

License

Stars

Watchers

Forks

Packages

No packages published