ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: queensgambit9 on March 21, 2018, 08:37:23 pm

Title: Remote filtering
Post by: queensgambit9 on March 21, 2018, 08:37:23 pm
Trying to use remote filtering, get error:

Code: [Select]
Notice: Trying to get property 'mode' of non-object in in deSerializeFilter function in PHP part.

Used sample from https://paramquery.com/pro/demos/filter_header
Any idea what could be wrong?
Title: Re: Remote filtering
Post by: paramvir on March 21, 2018, 09:33:41 pm
Error implies that $filterObj is not an object.

you might need to check value of $pq_filter and $filterObj
Title: Re: Remote filtering
Post by: queensgambit9 on March 22, 2018, 02:19:54 am
Seems to be the same:

Code: [Select]
public static function deSerializeFilter($pq_filter)       
    {

        // value of $pq_filter: {"mode":"AND","data":[{"dataIndx":"name","value":"test","condition":"contain","dataType":"string","cbFn":""}]}
       
        $filterObj = json_decode(json_encode($pq_filter), FALSE);
       
        // value of $filterObj: {"mode":"AND","data":[{"dataIndx":"name","value":"test","condition":"contain","dataType":"string","cbFn":""}]}

...
Title: Re: Remote filtering
Post by: queensgambit9 on March 22, 2018, 02:46:25 pm
Solved, had wrong syntax in SQL statement.
Title: Re: Remote filtering
Post by: queensgambit9 on March 22, 2018, 04:44:12 pm
Another question, when grid is filtred the records count etc doesn't seem to be auto updated when using remote data like when you use local data.
How can I adjust this?
Title: Re: Remote filtering
Post by: paramvir on March 22, 2018, 05:02:23 pm
Assuming you mean remote filtering without remote paging, it's straightforward

Code: [Select]
  var count = grid.getData().length
or
  var count = grid.option('dataModel.data').length
Title: Re: Remote filtering
Post by: queensgambit9 on March 22, 2018, 06:33:03 pm
I use both remote paging and filtering, but can't get the records count at the bottom to change when you filter the data, 1 to 10 of 100 items...
Title: Re: Remote filtering
Post by: paramvir on March 22, 2018, 09:46:00 pm
In case of remote paging, grid doesn't know the total records.

Hence it's important to return totalRecords in json response from remote script.
Title: Re: Remote filtering
Post by: queensgambit9 on March 23, 2018, 01:26:20 am
Thanks, solved.