*/
Roo.View = function(config, depreciated_tpl, depreciated_config){
+ this.parent = false;
+
if (typeof(depreciated_tpl) == 'undefined') {
// new way.. - universal constructor.
Roo.apply(this, config);
this.tpl.compile();
-
-
-
/** @private */
this.addEvents({
/**
*/
toggleSelect : false,
+ /**
+ * @cfg {Boolean} tickable - selecting
+ */
+ tickable : false,
+
/**
* Returns the element this view is bound to.
* @return {Roo.Element}
for(var i = 0, len = records.length; i < len; i++){
var data = this.prepareData(records[i].data, i, records[i]);
this.fireEvent("preparedata", this, data, i, records[i]);
+
+ var d = Roo.apply({}, data);
+
+ if(this.tickable){
+ Roo.apply(d, {'roo-id' : Roo.id()});
+
+ var _this = this;
+
+ Roo.each(this.parent.item, function(item){
+ if(item[_this.parent.valueField] != data[_this.parent.valueField]){
+ return;
+ }
+ Roo.apply(d, {'roo-data-checked' : 'checked'});
+ });
+ }
+
html[html.length] = Roo.util.Format.trim(
this.dataName ?
- t.applySubtemplate(this.dataName, data, this.store.meta) :
- t.apply(data)
+ t.applySubtemplate(this.dataName, d, this.store.meta) :
+ t.apply(d)
);
}
/** @ignore */
onClick : function(e){
- Roo.log('view click');
var item = this.findItemFromChild(e.getTarget());
- Roo.log(item);
if(item){
var index = this.indexOf(item);
- Roo.log(index);
if(this.onItemClick(item, index, e) !== false){
this.fireEvent("click", this, index, item, e);
}
if(this.fireEvent("beforeclick", this, index, item, e) === false){
return false;
}
- Roo.log('onItemClick');
if (this.toggleSelect) {
var m = this.isSelected(item) ? 'unselect' : 'select';
Roo.log(m);
this.select(item, this.multiSelect && e.ctrlKey);
this.lastSelection = item;
}
-// e.preventDefault();
+
+ if(!this.tickable){
+ e.preventDefault();
+ }
+
}
return true;
},