Fix up dataview / nm filter changes. Removes extra server call to ajax_get_rows.

This commit is contained in:
Nathan Gray 2013-11-06 18:55:57 +00:00
parent f660ac5a8a
commit 39c1efc789
2 changed files with 14 additions and 21 deletions

View File

@ -129,9 +129,6 @@ var et2_dataview_controller = Class.extend({
* @param {boolean} clear
*/
update: function (clear) {
// Clear the fetch queue
this._queue = {};
this._clearTimer();
// ---------
@ -140,20 +137,11 @@ var et2_dataview_controller = Class.extend({
if(clear)
{
this._grid.clear();
this._grid.clear.apply(this._grid,[]);
}
// Remove all rows which are outside the view range
this._grid.cleanup();
// Remove all index entries which are currently not displayed
for (var key in this._indexMap)
{
if (!this._indexMap[key].row)
{
delete this._indexMap[key];
}
}
// ---------
// Get the currently visible range from the grid
@ -772,11 +760,11 @@ var et2_dataview_controller = Class.extend({
}
// Make sure _response.order.length is not longer than the requested
// count
var order = _response.order.splice(0, this.count);
// count, if a specific count was requested
var order = this.count != 0 ? _response.order.splice(0, this.count) : _response.order;
// Get the current index map for the updated region
var idxMap = this.self._getIndexMapping(this.start, this.count);
var idxMap = this.self._getIndexMapping(this.start, order.length);
// Update the grid using the new order. The _updateOrder function does
// not update the internal mapping while inserting and deleting rows, as

View File

@ -400,6 +400,9 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
}
}, this.activeFilters.col_filter, et2_INextmatchHeader);
// Explicitly the total count to zero, we're going to get some new info
this.controller._grid.setTotalCount(0);
// Trigger an update
this.controller.update(true);
},
@ -864,10 +867,6 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
this.rowProvider.setDataRowTemplate(columnWidgets, _rowData, this);
// Set the initial row count
var total = typeof this.options.settings.total != "undefined" ?
this.options.settings.total : 0;
this.dataview.grid.setTotalCount(total);
// Create the grid controller
this.controller = new et2_nextmatch_controller(
@ -897,6 +896,12 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
));*/
this.controller.setFilters(this.activeFilters);
// Set the initial row count
var total = typeof this.options.settings.total != "undefined" ?
this.options.settings.total : 0;
// This triggers an invalidate, which updates the grid
this.dataview.grid.setTotalCount(total);
},
_parseGrid: function(_grid) {