projects
/
roojs1
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
try and get ctrl-enter to add a clear all
[roojs1]
/
Roo
/
View.js
diff --git
a/Roo/View.js
b/Roo/View.js
index
9189659
..
e6b134d
100644
(file)
--- a/
Roo/View.js
+++ b/
Roo/View.js
@@
-49,6
+49,8
@@
*/
Roo.View = function(config, depreciated_tpl, depreciated_config){
*/
Roo.View = function(config, depreciated_tpl, depreciated_config){
+ this.parent = false;
+
if (typeof(depreciated_tpl) == 'undefined') {
// new way.. - universal constructor.
Roo.apply(this, config);
if (typeof(depreciated_tpl) == 'undefined') {
// new way.. - universal constructor.
Roo.apply(this, config);
@@
-72,10
+74,7
@@
Roo.View = function(config, depreciated_tpl, depreciated_config){
this.tpl.compile();
this.tpl.compile();
-
-
-
/** @private */
this.addEvents({
/**
/** @private */
this.addEvents({
/**
@@
-162,7
+161,7
@@
Roo.View = function(config, depreciated_tpl, depreciated_config){
var fctr = this.wrapEl.appendChild(document.createElement("div"));
var fctr = this.wrapEl.appendChild(document.createElement("div"));
- this.footer.dataSource = this.store
+ this.footer.dataSource = this.store
;
this.footer.container = fctr;
this.footer = Roo.factory(this.footer, Roo);
fctr.insertFirst(this.el);
this.footer.container = fctr;
this.footer = Roo.factory(this.footer, Roo);
fctr.insertFirst(this.el);
@@
-245,7
+244,7
@@
Roo.extend(Roo.View, Roo.util.Observable, {
* Refreshes the view. - called by datachanged on the store. - do not call directly.
*/
refresh : function(){
* Refreshes the view. - called by datachanged on the store. - do not call directly.
*/
refresh : function(){
- Roo.log('refresh');
+
//
Roo.log('refresh');
var t = this.tpl;
// if we are using something like 'domtemplate', then
var t = this.tpl;
// if we are using something like 'domtemplate', then
@@
-280,9
+279,19
@@
Roo.extend(Roo.View, Roo.util.Observable, {
var data = this.prepareData(records[i].data, i, records[i]);
this.fireEvent("preparedata", this, data, i, records[i]);
var data = this.prepareData(records[i].data, i, records[i]);
this.fireEvent("preparedata", this, data, i, records[i]);
- var d = data;
+ var d = Roo.apply({}, data);
+
if(this.tickable){
Roo.apply(d, {'roo-id' : Roo.id()});
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(
}
html[html.length] = Roo.util.Format.trim(
@@
-314,7
+323,7
@@
Roo.extend(Roo.View, Roo.util.Observable, {
},
onUpdate : function(ds, record){
},
onUpdate : function(ds, record){
- Roo.log('on update');
+
//
Roo.log('on update');
this.clearSelections();
var index = this.store.indexOf(record);
var n = this.nodes[index];
this.clearSelections();
var index = this.store.indexOf(record);
var n = this.nodes[index];
@@
-328,7
+337,7
@@
Roo.extend(Roo.View, Roo.util.Observable, {
// --------- FIXME
onAdd : function(ds, records, index)
{
// --------- FIXME
onAdd : function(ds, records, index)
{
- Roo.log(['on Add', ds, records, index] );
+
//
Roo.log(['on Add', ds, records, index] );
this.clearSelections();
if(this.nodes.length == 0){
this.refresh();
this.clearSelections();
if(this.nodes.length == 0){
this.refresh();
@@
-348,7
+357,7
@@
Roo.extend(Roo.View, Roo.util.Observable, {
},
onRemove : function(ds, record, index){
},
onRemove : function(ds, record, index){
- Roo.log('onRemove');
+
//
Roo.log('onRemove');
this.clearSelections();
var el = this.dataName ?
this.el.child('.roo-tpl-' + this.dataName) :
this.clearSelections();
var el = this.dataName ?
this.el.child('.roo-tpl-' + this.dataName) :
@@
-412,7
+421,7
@@
Roo.extend(Roo.View, Roo.util.Observable, {
*/
onBeforeLoad : function(store,opts)
{
*/
onBeforeLoad : function(store,opts)
{
- Roo.log('onBeforeLoad');
+
//
Roo.log('onBeforeLoad');
if (!opts.add) {
this.el.update("");
}
if (!opts.add) {
this.el.update("");
}
@@
-483,7
+492,7
@@
Roo.extend(Roo.View, Roo.util.Observable, {
}
if (this.toggleSelect) {
var m = this.isSelected(item) ? 'unselect' : 'select';
}
if (this.toggleSelect) {
var m = this.isSelected(item) ? 'unselect' : 'select';
- Roo.log(m);
+
//
Roo.log(m);
var _t = this;
_t[m](item, true, false);
return true;
var _t = this;
_t[m](item, true, false);
return true;
@@
-584,6
+593,7
@@
Roo.extend(Roo.View, Roo.util.Observable, {
if(!keepExisting){
this.clearSelections(true);
}
if(!keepExisting){
this.clearSelections(true);
}
+
if(this.fireEvent("beforeselect", this, node, this.selections) !== false){
Roo.fly(node).addClass(this.selectedClass);
this.selections.push(node);
if(this.fireEvent("beforeselect", this, node, this.selections) !== false){
Roo.fly(node).addClass(this.selectedClass);
this.selections.push(node);
@@
-610,7
+620,7
@@
Roo.extend(Roo.View, Roo.util.Observable, {
}
var node = this.getNode(nodeInfo);
if(!node || !this.isSelected(node)){
}
var node = this.getNode(nodeInfo);
if(!node || !this.isSelected(node)){
- Roo.log("not selected");
+
//
Roo.log("not selected");
return; // not selected.
}
// fireevent???
return; // not selected.
}
// fireevent???