Author Topic: Remote filtering  (Read 3559 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Remote filtering
« 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?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Remote filtering
« Reply #1 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

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Remote filtering
« Reply #2 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":""}]}

...

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Remote filtering
« Reply #3 on: March 22, 2018, 02:46:25 pm »
Solved, had wrong syntax in SQL statement.
« Last Edit: March 22, 2018, 04:17:01 pm by queensgambit9 »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Remote filtering
« Reply #4 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?
« Last Edit: March 22, 2018, 04:48:50 pm by queensgambit9 »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Remote filtering
« Reply #5 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

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Remote filtering
« Reply #6 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...

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Remote filtering
« Reply #7 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.

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Remote filtering
« Reply #8 on: March 23, 2018, 01:26:20 am »
Thanks, solved.