mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-18 11:58:24 +01:00
Enhance refreshItem() to optionally take the data needed for refreshing to avoid an extra call to the server
This commit is contained in:
parent
8140ecf24b
commit
04a845fa35
@ -450,10 +450,12 @@ var et2_tree = et2_inputWidget.extend(
|
|||||||
* Updates a leaf of the tree by requesting new information from the server using the
|
* Updates a leaf of the tree by requesting new information from the server using the
|
||||||
* autoloading attribute.
|
* autoloading attribute.
|
||||||
*
|
*
|
||||||
* @param _id ID of the node
|
* @param {string} _id ID of the node
|
||||||
|
* @param {Object} [data] If provided, the item is refreshed directly with
|
||||||
|
* the provided data instead of asking the server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
refreshItem: function(_id) {
|
refreshItem: function(_id,data) {
|
||||||
if(this.input == null) return null;
|
if(this.input == null) return null;
|
||||||
this.input.deleteChildItems(_id);
|
this.input.deleteChildItems(_id);
|
||||||
this.input.setDataMode('JSON');
|
this.input.setDataMode('JSON');
|
||||||
@ -463,9 +465,18 @@ var et2_tree = et2_inputWidget.extend(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.input.loadJSON(this.egw().link(this.autoloading_url, {id: _id}),
|
if(typeof data != 'undefined' && data != null)
|
||||||
function() { self._dhtmlxtree_json_callback(JSON.parse(this.response), _id);}
|
{
|
||||||
);
|
this.input.loadJSONObject(data,
|
||||||
|
function() { self._dhtmlxtree_json_callback(data, _id);}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.input.loadJSON(this.egw().link(this.autoloading_url, {id: _id}),
|
||||||
|
function() { self._dhtmlxtree_json_callback(JSON.parse(this.response), _id);}
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user