Add node.data

rel-1.0
Vitaliy Filippov 2016-02-24 17:08:00 +03:00
parent b3476556ed
commit 2e2ae80aa1
2 changed files with 32 additions and 2 deletions

View File

@ -13,7 +13,8 @@
* cells: [ 'html' or { innerHTML, style, className, title }, ... ],
* children: [ node... ],
* leaf: true/false,
* collapsed: true/false
* collapsed: true/false,
* data: <user data>
* }, ... ]
*
* header: [ 'html' or { innerHTML, style, className, title }, ... ]
@ -69,6 +70,7 @@ function TreeGridNode(node, grid, level, insertBefore, startHidden)
{
this.grid = grid;
this.level = level;
this.data = node.data;
if (this.level === undefined)
this.level = -1;
if (!grid.root)

30
util.js
View File

@ -158,10 +158,18 @@ window.http_build_query = function(data)
var encoded = '';
for (var i in data)
{
encoded = encoded+'&'+encodeURIComponent(i)+'='+(data[i] === false || data[i] === null ? '' : encodeURIComponent(data[i]));
if (typeof data[i] == 'object')
{
var ii = encodeURIComponent(i);
for (var k in data[i])
encoded = encoded+'&'+ii+'['+encodeURIComponent(k)+']='+(data[i][k] === false || data[i] === null ? '' : encodeURIComponent(data[i]));
}
else
encoded = encoded+'&'+encodeURIComponent(i)+'='+(data[i] === false || data[i] === null ? '' : encodeURIComponent(data[i]));
}
return encoded.substr(1);
};
window.GET = function(url, data, cb)
{
var r = createRequestObject();
@ -183,6 +191,26 @@ window.POST = function(url, data, cb)
r.send(data);
};
window.cloneObject = function(o)
{
if (!o || 'object' !== typeof o)
return o;
var c = 'function' === typeof o.pop ? [] : {};
var p, v;
for (p in o)
{
if (o.hasOwnProperty(p))
{
v = o[p];
if(v && 'object' === typeof v)
c[p] = cloneObject(v);
else
c[p] = v;
}
}
return c;
}
// Get element position using getBoundingClientRect()
var getOffsetRect = function(elem)
{