Skip to content

public.js #339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var Grid = function(element, options)
// overrides rowCount explicitly because deep copy ($.extend) leads to strange behaviour
var rowCount = this.options.rowCount = this.element.data().rowCount || options.rowCount || this.options.rowCount;
this.columns = [];
this.current = 1;
this.current = this.options.current;
this.currentRows = [];
this.identifier = null; // The first column ID that is marked as identifier
this.selection = false;
Expand All @@ -27,7 +27,7 @@ var Grid = function(element, options)
this.rows = [];
this.searchPhrase = "";
this.selectedRows = [];
this.sortDictionary = {};
this.sortDictionary = this.options.sortDictionary;
this.total = 0;
this.totalPages = 0;
this.cachedParams = {
Expand Down Expand Up @@ -60,6 +60,8 @@ Grid.defaults = {
padding: 2, // page padding (pagination)
columnSelection: true,
rowCount: [10, 25, 50, -1], // rows per page int or array of int (-1 represents "All")
current: 1, // Current page 1
sortDictionary: {}, // No sort option

/**
* Enables row selection (to enable multi selection see also `multiSelect`). Default value is `false`.
Expand Down Expand Up @@ -853,4 +855,4 @@ Grid.prototype.getTotalPageCount = function()
Grid.prototype.getTotalRowCount = function()
{
return this.total;
};
};