mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 18:03:39 +01:00
some wrapper functions to retrieve the label of a selected node, and to retrieve the selected node itself
This commit is contained in:
parent
33e94d355c
commit
5337cc83d2
@ -257,9 +257,49 @@ var et2_tree = et2_inputWidget.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getValue, retrieves the Id of the selected Item
|
||||||
|
* @return string or object or null
|
||||||
|
*/
|
||||||
getValue: function() {
|
getValue: function() {
|
||||||
if(this.input == null) return null;
|
if(this.input == null) return null;
|
||||||
return this.options.multiple ? this.input.getAllChecked().split(this.input.dlmtr) : this.input.getSelectedItemId();
|
return this.options.multiple ? this.input.getAllChecked().split(this.input.dlmtr) : this.input.getSelectedItemId();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getSelectedLabel, retrieves the Label of the selected Item
|
||||||
|
* @return string or null
|
||||||
|
*/
|
||||||
|
getSelectedLabel: function() {
|
||||||
|
if(this.input == null) return null;
|
||||||
|
if (this.options.multiple)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
var out = [];
|
||||||
|
var checked = this.input.getAllChecked().split(this.input.dlmtr);
|
||||||
|
for(var i = 0; i < checked.length; i++)
|
||||||
|
{
|
||||||
|
out.push(this.input.getItemText(checked[i]));
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
*/
|
||||||
|
return null; // not supported yet
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return this.input.getSelectedItemText();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getSelectedNode, retrieves the full node of the selected Item
|
||||||
|
* @return string or null
|
||||||
|
*/
|
||||||
|
getSelectedNode: function() {
|
||||||
|
if(this.input == null) return null;
|
||||||
|
// no support for multiple selections
|
||||||
|
// as there is no get Method to return the full selected node, we use this
|
||||||
|
return this.options.multiple ? null : this.input._selected[0];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
et2_register_widget(et2_tree, ["tree","tree-cat"]);
|
et2_register_widget(et2_tree, ["tree","tree-cat"]);
|
||||||
|
Loading…
Reference in New Issue
Block a user