U
U
UngVas2014-03-27 22:36:41
ExtJS/Sencha
UngVas, 2014-03-27 22:36:41

ExtJS 4.1.1, JsonStore, extraParams, Grid with server-side pagination, how to set parameters in Store?

There is a report, a simple grid, set up server pagination, everything works fine. But...
The report data depends on the selected date (from the datefield), that is, I select a date, and a request is sent to the server with the (date) parameter in addition to (start, limit, page) and the required report is returned, but when I click on pagination, then it does not work correctly, because the parameter (date) is not passed.
The only solution is to somehow pass an additional parameter or something similar during the click. Or save the last selected date on the server, or ... there are many bad decisions :D
I think there are those who have encountered such a problem.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
UngVas, 2014-03-28
@UngVas

fornit1917 thanks ))
I solved the problem in this way:

<code lang="javascript">

 listeners: {
        'beforeload': function (store, options) {

            if (typeof Ext.ComponentQuery.query('toolbar[name=gridToolbar] datefield')[0] === 'undefined') {

                var currDate = moment().format("D.M.YYYY");

                store.proxy.extraParams.d1 = currDate;
                store.proxy.extraParams.d2 = currDate;

            }
            else {

                store.proxy.extraParams.d1 = selectedDate(0);
                store.proxy.extraParams.d2 = selectedDate(1);
            }
        }
</code>

I check if the dateFiled component does not yet exist, then this means that I just went to the page with the report and the report for today is set

V
Vit, 2014-03-28
@fornit1917

extraParams store is what you need
For example, see here: stackoverflow.com/questions/11896163/use-extra-par...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question