Hi Tony,
great work so far… but could you integrate a storage function for the grid-selection? what do you think?
My intention was the problem getting all selected rows eg. for editing or mass-delete… but on paging, sorting or with a live-grid, the selection gets lost! I wrote a small plugin to solve this, but it's “wasting” some events…
/**
* keeps selection on paging and sorting
*
* @author Patrick Kracht
*/
//This prototype is provided by the Mozilla foundation and
//is distributed under the MIT license.
//http://www.ibiblio.org/pub/Linux/LICENSES/mit.license
if (!Array.prototype.indexOf)
{
Array.prototype.indexOf = function(elt /*, from*/)
{
var len = this.length;
var from = Number(arguments[1]) || 0;
from = (from < 0)
? Math.ceil(from)
: Math.floor(from);
if (from < 0)
from += len;
for (; from < len; from++)
{
if (from in this &&
this[from] === elt)
return from;
}
return -1;
};
}
;(function($)
{
var _stored = [];
var _active = [];
function _addDiff(grid,data_old,data_new)
{
var id = grid.attr('id');
for (var i = 0; i < data_new.length; i++)
{
//neuer Wert
var val = data_new;
//wenn im alten Array der neue Wert nicht vorkommt und noch nicht gespeichert
if ( data_old.indexOf(val) < 0 && _stored[id].indexOf(val) < 0 && val.length != 0 )
{
//ID adden
_stored[id].push(val);
}
}
};
function _delDiff(grid,data_old,data_new)
{
var id = grid.attr('id');
for (var i = 0; i < data_old.length; i++)
{
//Position des alten Werts im Speicher suchen
var pos = _stored[id].indexOf(data_old);
//wenn in aktueller Auswahl nicht mehr und noch im Speicher
if ( data_new.indexOf(data_old) < 0 && pos >= 0 )
{
//Element l
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top