1
votes

I am using extJs4.0 and I have created a grid with pagination, where i am loading the data in each call. 25 rows in a single load. Having text box at the top of the column to use filters, but those filters are only working on a single page as i am loading the data pagewise. having more than 3500 rows in DB. so can not load all in a single call. But my requirement is to filter the whole data(DB) with maching values. Please advice me how to achieve it or is it possible in extJs to dael with such a huge data. Please help!!!!

1

1 Answers

2
votes

You need to use the remoteFilter config option. This will delegate all filtering to be done on the server, on the full dataset, rather than the currently loaded set.

This will pass filter params to the backend, so you will need to write the logic to return the filtered, paginated dataset on the server (if any filter params are required/set).

There is a basic example in the Sencha Examples.

UPDATE:

When using remoteFilter when you apply filters to the store it will make a request back to the server with the filter params. You would need to filter your dataset based on these params on your server side.

In PHP you might do something like this: (pseudo code)

<?php
// Include any db classes or frameworks your using, and anything else you need
$filters = array();

if (isset($_POST['customer_name'])) {
    $filters[] = array('customer_name' => $_POST['customer_name']) // dont forget to escape it for security
}

You should already be passing pagination params in, So when you come to getting your data from the DB, you could do something like

$customers = $model->getCustomers($filters, $options); // pass in filter and pagination options

This could result in a query such as

'SELECT * FROM customers WHERE customer_name LIKE '%jones%' LIMIT 20, 20'

Which would return 20 filtered records based on search params

It's difficult to provide an accurate answer without knowing what your using server side, but this should give you an idea or even a basis for your research.