/**
* @cfg {Boolean} multiSelect Allow multiple selection
*/
-
multiSelect : false,
/**
* @cfg {Boolean} singleSelect Allow single selection
*/
singleSelect: false,
+ /**
+ * @cfg {Boolean} toggleSelect - selecting
+ */
+ toggleSelect : false,
+
/**
* Returns the element this view is bound to.
* @return {Roo.Element}
}
},
- onItemClick : function(item, index, e){
+ onItemClick : function(item, index, e)
+ {
if(this.fireEvent("beforeclick", this, index, item, e) === false){
return false;
}
+ if (this.toggleSelect) {
+ var m = this.isSelected(item) ? 'unselect' : 'select';
+ Roo.log(m);
+ var _t = this;
+ _t[m](item, true, false);
+ return true;
+ }
if(this.multiSelect || this.singleSelect){
if(this.multiSelect && e.shiftKey && this.lastSelection){
this.select(this.getNodes(this.indexOf(this.lastSelection), index), false);
/**
* Unselects nodes.
* @param {Array/HTMLElement/String/Number} nodeInfo An HTMLElement template node, index of a template node, id of a template node or an array of any of those to select
+ * @param {Boolean} keepExisting (optional) true IGNORED (for campatibility with select)
* @param {Boolean} suppressEvent (optional) true to skip firing of the selectionchange vent
*/
- unselect : function(nodeInfo, suppressEvent)
+ unselect : function(nodeInfo, keepExisting, suppressEvent)
{
if(nodeInfo instanceof Array){
Roo.each(this.selections, function(s) {
}
var node = this.getNode(nodeInfo);
if(!node || !this.isSelected(node)){
+ Roo.log("not selected");
return; // not selected.
}
+ // fireevent???
+ var ns = [];
+ Roo.each(this.selections, function(s) {
+ if (s == node ) {
+ Roo.fly(node).removeClass(this.selectedClass);
+
+ return;
+ }
+ ns.push(s);
+ },this);
-
-
- }
+ this.selections= ns;
+ this.fireEvent("selectionchange", this, this.selections);
+ },
/**
* Gets a template node.