ruby on rails - Dividing up an index params into multiple pages -
i have list of records have displayed on index page. (they displayed in table form). because there number of them trying divide them 30 records per page. i've created search params functionality index displayed beneath it.
the problem having having trouble getting more 1 page render on list. of right have 150 records. have 1 page listed 30 records on , not able sort through them. have idea missing?
here segment in code gets addresssed.
def search_params default_index_params.merge(params.fetch(:record_collection, {})).with_indifferent_access end def default_index_params { per: 30, page: 1, sort_by: "created_at", sort_direction: "desc", customer_id: 0 } end
in view, have little bit of coffee-script plays role in table itself. don't know if root of problem, have here well.
:coffeescript $('#record_table').datatable aasorting: [[1, 'asc']] bpaginate: false bfilter: false, aocolumns:[null, null, null, null, null, { bsortable: false }, null, { bsortable: false }]
my record collection used defining params, don't think useful problem. (but post if needed)
thanks in advance able figure out going on this.
you need pass paging: true , pagelength: 30 in coffescript, , remove page: 1,per: 30 default_index_params method. coffeescript this:
:coffeescript $('#record_table').datatable aasorting: [[1, 'asc']] paging: true pagelength: 30 bfilter: false, aocolumns:[null, null, null, null, null, { bsortable: false }, null, { bsortable: false }]
your default_index_params looks this:
def default_index_params { sort_by: "created_at", sort_direction: "desc", customer_id: 0 } end
Comments
Post a Comment