Jsgrid: Change PageSize based on external values (dropdown list)

Created on 24 Feb 2016  路  6Comments  路  Source: tabalinas/jsgrid

Hi i'm using jsgrid for the company for which i work, and as in the title i have this problem.

I need to have a dropdown list with some value, and depending from this values the number of displayed object have to change. There's a way to do it? i didn't find any clue on the documentation, i could be a bad searcher, but can someone give me an help?

question

Most helpful comment

Hi, what is about setting option pageSize http://js-grid.com/docs/#pagesize-default-20?

$("#grid").jsGrid("option", "pageSize", 100); 

All 6 comments

Hi, what is about setting option pageSize http://js-grid.com/docs/#pagesize-default-20?

$("#grid").jsGrid("option", "pageSize", 100); 

is exactly what i needed! Just didn't perfectly get the documentation explanation!

thank you for the help!

You are always welcome!

This was very helpful and and its working fine when I change the page size when the drop-down value changes. But I want to change the page size after I get the response from ajax call as it will handle all possible scenarios in my case.
Can you please help me with this.

Hi, what is about setting option pageSize http://js-grid.com/docs/#pagesize-default-20?

$("#grid").jsGrid("option", "pageSize", 100); 

excellent.

This was very helpful and and its working fine when I change the page size when the drop-down value changes. But I want to change the page size after I get the response from ajax call as it will handle all possible scenarios in my case.
Can you please help me with this.

If I get what you need correctly, you'll need to look at loadData option. Something like this:

loadData: function () {
            let d = $.Deferred();
            $.ajax({
                url:      ajax_url,
                dataType: "json",
                method:   "METHOD"
            }).done(function (response) {
                // !-- set the pageSize here --!
                d.resolve(response);
            }).fail(function (response) {
                d.reject();
            });
            return d.promise();
        }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

gianlucaqo picture gianlucaqo  路  4Comments

danielson317 picture danielson317  路  3Comments

am2222 picture am2222  路  4Comments

julmarci picture julmarci  路  4Comments

Julian-B90 picture Julian-B90  路  4Comments