Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(this.grid).jqGrid({
- gridComplete: $.proxy(this._onPageLoaded, this),
- onSelectAll: $.proxy(this._onSelectAllPress, this),
- onSelectRow: $.proxy(this._onSelectRow, this)
- });
- /**
- * Handles clicks to the check-all box
- */
- _onSelectAllPress: function (ids, status) {
- // 10/05/2010: Bug in jqGrid 3.8.1: undefined item added to front of ids when selecting all, and "" added
- // to front of ids when removing all selections
- if (typeof(ids[0]) === "undefined" || typeof(ids[0]) === "") {
- ids.shift();
- }
- if (status) {
- this._addIdsToSelectedCache(ids);
- } else {
- this._removeIdsFromSelectedCache(ids);
- }
- },
- /**
- * Handles single record selections
- */
- _onSelectRow: function (id, selected) {
- var row = $(this.grid).jqGrid("getRowData", id);
- if (selected) {
- this._addRowToSelectedCache(id, row['provider'], row['fileid']);
- } else {
- this._removeRowFromSelectedCache(id);
- }
- },
- /**
- * Performs some actions when a page from the grid results is displayed
- *
- * NOTE 10/15/2010: Also triggered during sorting and filtering, but data = undefined!
- */
- _onPageLoaded: function () {
- var grid, page, hires, content, shadow, self = this;
- grid = $(this.grid);
- page = grid.jqGrid('getGridParam', 'page');
- // If this is first time on page, cache and exit
- if ($.inArray(page, this._pagesViewed) === -1) {
- this._pagesViewed.push(page);
- return;
- }
- // Otherwise check to see if any checkboxes on the current page have previously been checked
- $.each(grid.jqGrid("getDataIDs"), function (i, id) {
- if (self._selected[id]) {
- $("#" + id + " .cbox").attr("checked", "checked");
- }
- });
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement