Data Connector filter and params

I am using PHP Data Connector to pull data from server into datatable. Dynamic loading of 10 records at a time, with sorting and filtering happening server side. All working fine.

But two issues:

  1. If I use serverFilter in the columns def, that works fine. But when I try to use a custom filter() function on a certain field (like attached to a button click event), I get:

    “Uncaught TypeError: Cannot read property ‘xyear’ of undefined”

The syntax I am using is

$$("dtable").filter("xyear", "1995");

What would cause that?

  1. How would I programmatically add parameters to the data call before it gets sent to the Connector PHP file? When I use serverFilter in the columns def, I can see that Webix sends a url like:

    http://www.example.com/connector.php?continue=true&filter[xyear]=1995

How would I set that parameter programmatically and then fill the grid (like based on a button click)?

Thanks

I have figured out #2 through the datatable load method.

However #1 is giving me big problems. When I inspect the datatable object I can see that my 10 records are coming through fine, but then there is always an additional element that is undefined. i.e. the last index is always undefined which throws an error on any custom filter.

I found the following post:

http://forum.webix.com/discussion/comment/3289/#Comment_3289

This indicates there was a bug that was to be fixed. I am using the data_connector.php file in the download package under samples/common/connector.

Is there still a bug in connector file and if so is there a newer/fixed version available?

Please help, this is preventing me moving forward.

Thanks

UPDATE:

I have found the problem is with dynamic loading. If dynamic loading is turned off in the PHP file, OR if all records are loaded in at once, then custom filtering works fine. But if a subset of records are loaded via dynamic loading, then I get the Uncaught TypeError, referencing webix.js line 397

Please help

Here is an example of the problem:

  1. Go to:

    http://docs.webix.com/samples/15_datatable/16_dyn_loading/01_db_dyn_data.html

the file data_dyn.php is set to dynamic loading for 30 records. The total count is 999 records.

  1. In the console, attempt to run:

    grida.filter(“architecture”,“all”)

Uncaught TypeError results

  1. Now either turn off dynamic loading, or change

    $data->dynamic_loading(30);

to

$data->dynamic_loading(1000);
  1. In the console, attempt to run:

    grida.filter(“architecture”,“all”)

It works

Please weigh in on what is causing this

Hi,

the thing is that Webix does not support client-side filtering on a dynamically load set. If you worked with webix_debug.js ( it’s included on a dev stage instead of webix.js), you would see the “Client side filtering can’t be used with dynamic loading” warning.

So, you can either use server filters or switch off dynamic loading.
If you are somehow limited by connector dynamic loading pattern, you can try a custom proxy to load dynamically.