Dataobject filtering


Dataobject supports several ways how to query/filter data.

Developers can use datobject designer for that.

WherClause is typically used only by developers, to initially filter data. Although filter string can be changed by other controls like data field filter and filter builder, it is used by app user.

WhereClause & FilterString

As mentioned previously, where clause is used by developers only when designing an app and it can be set in javascript as well:

    
    //dsObject.recordSource.setFilterString
    dsObject.recordSource.setWhereClause("SomeColumn = ''some value AND "OtherColumn = 'other value'"")
    

To get where clause:

    
    dsObject.recordSource.getWhereClause()
    dsObject.recordSource.getFilterString()
    
Note: When using filter string it will be shown in data-filterstring bounded elements.

WhereObject & FilterObject

Where and filter object expects devexpress filter object

    
    
    //dsObject.recordSource.setFilterObject({
    dsObject.recordSource.setWhereObject({
        type: 'group', mode: 'and', items: [ 
            {type: 'expression', column: 'MyParam', operator: 'equals', valueType: 'number', value: 123 }
        ]
    });
    /* Getters */
    dsObject.recordSource.getFilterObject()
    dsObject.recordSource.getWhereObject()

Currently we do not support combining whereClause with whereObject and filterString with filterObject, so it will use only one of them.



Related articles