X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=roojs-debug.js;h=bbfe5cb85ef225f8ac3c6838b16bd643c33921e2;hb=refs%2Fheads%2Fwip_alan_T6652_pass_gridview_events_into_grid;hp=7b65ff1ce66b2dc3df1082d0de844a9dfa5bf27d;hpb=e2f3f95937a0262710ebbdf11f3f122a1d6fdfbd;p=roojs1 diff --git a/roojs-debug.js b/roojs-debug.js index 7b65ff1ce6..bbfe5cb85e 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -4678,6 +4678,12 @@ Roo.Template = function(cfg){ }; Roo.Template.prototype = { + /** + * @cfg {Function} onLoad Called after the template has been loaded and complied (usually from a remove source) + */ + onLoad : false, + + /** * @cfg {String} url The Url to load the template from. beware if you are loading from a url, the data may not be ready if you use it instantly.. * it should be fixed so that template is observable... @@ -4687,11 +4693,18 @@ Roo.Template.prototype = { * @cfg {String} html The HTML fragment or an array of fragments to join("") or multiple arguments to join("") */ html : '', + + + compiled : false, + loaded : false, /** * Returns an HTML fragment of this template with the specified values applied. * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) * @return {String} The HTML fragment */ + + + applyTemplate : function(values){ //Roo.log(["applyTemplate", values]); try { @@ -4752,9 +4765,13 @@ Roo.Template.prototype = { method : 'GET', success : function (response) { _t.loading = false; - _t.html = response.responseText; _t.url = false; - _t.compile(); + + _t.set(response.responseText,true); + _t.loaded = true; + if (_t.onLoad) { + _t.onLoad(); + } }, failure : function(response) { Roo.log("Template failed to load from " + _t.url); @@ -4771,7 +4788,7 @@ Roo.Template.prototype = { */ set : function(html, compile){ this.html = html; - this.compiled = null; + this.compiled = false; if(compile){ this.compile(); } @@ -22547,7 +22564,7 @@ Roo.dd.DropTarget = function(el, config){ * target. This default implementation adds the CSS class specified by overClass (if any) to the drop element * and returns the dropAllowed config value. This method should be overridden if drop validation is required. * - * IMPORTANT : it should set this.overClass and this.dropAllowed + * IMPORTANT : it should set this.valid to true|false * * @param {Roo.dd.DragSource} source The drag source that was dragged over this drop target * @param {Event} e The event @@ -22561,7 +22578,7 @@ Roo.dd.DropTarget = function(el, config){ * This method will be called on every mouse movement while the drag source is over the drop target. * This default implementation simply returns the dropAllowed config value. * - * IMPORTANT : it should set this.dropAllowed + * IMPORTANT : it should set this.valid to true|false * * @param {Roo.dd.DragSource} source The drag source that was dragged over this drop target * @param {Event} e The event @@ -22575,6 +22592,7 @@ Roo.dd.DropTarget = function(el, config){ * out of the target without dropping. This default implementation simply removes the CSS class specified by * overClass (if any) from the drop element. * + * * @param {Roo.dd.DragSource} source The drag source that was dragged over this drop target * @param {Event} e The event * @param {Object} data An object containing arbitrary data supplied by the drag source @@ -45206,8 +45224,8 @@ Roo.HtmlEditorCore.cblack= [ Roo.HtmlEditorCore.swapCodes =[ - [ 8211, "--" ], - [ 8212, "--" ], + [ 8211, "–" ], + [ 8212, "—" ], [ 8216, "'" ], [ 8217, "'" ], [ 8220, '"' ], @@ -51453,10 +51471,10 @@ Roo.DDView = function(container, tpl, config) { this.getEl().setStyle("outline", "0px none"); this.getEl().unselectable(); if (this.dragGroup) { - this.setDraggable(this.dragGroup.split(",")); + this.setDraggable(this.dragGroup.split(",")); } if (this.dropGroup) { - this.setDroppable(this.dropGroup.split(",")); + this.setDroppable(this.dropGroup.split(",")); } if (this.deletable) { this.setDeletable(); @@ -55380,7 +55398,52 @@ Roo.grid.Grid = function(container, config){ * Fires when the grid is rendered * @param {Grid} grid */ - 'render' : true + 'render' : true, + + /** + * @event beforerowremoved + * Fires before row is removed + * @param {Roo.grid.GridView} gridview + */ + "beforerowremoved" : true, + /** + * @event beforerowsinserted + * Fires before row is inserted + * @param {Roo.grid.GridView} grid + */ + "beforerowsinserted" : true, + /** + * @event beforerefresh + * Fires before grid is refresh + * @param {Roo.grid.GridView} gridView + */ + "beforerefresh" : true, + /** + * @event rowremoved + * Fires when row is removed + * @param {Roo.grid.GridView} grid + */ + "rowremoved" : true, + /** + * @event rowsinserted + * Fires when the row is inserted + * @param {Roo.grid.GridView} grid + */ + "rowsinserted" : true, + /** + * @event rowupdated + * Fires when the row is updated + * @param {Roo.grid.GridView} grid + */ + "rowupdated" : true, + /** + * @event refresh + * Fires when the grid is refreshed + * @param {Roo.grid.GridView} grid + */ + "refresh" : true + + }); Roo.grid.Grid.superclass.constructor.call(this); @@ -55390,6 +55453,9 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, { /** * @cfg {String} ddGroup - drag drop group. */ + /** + * @cfg {String} dragGroup - drag group (?? not sure if needed.) + */ /** * @cfg {Number} minColumnWidth The minimum width a column can be resized to. Default is 25. @@ -55426,6 +55492,9 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, { /** * @cfg {Boolean} enableDrag True to enable drag of rows. Default is false. (double check if this is needed?) + */ + /** + * @cfg {Boolean} enableDrop True to enable drop of elements. Default is false. (double check if this is needed?) */ /** @@ -55500,6 +55569,15 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, { /** * @cfg {Number} maxHeight Sets the maximum height of the grid - ignored if autoHeight is not on. */ + + + /** + * @cfg {String} ddText Configures the text is the drag proxy (defaults to "%0 selected row(s)"). + * %0 is replaced with the number of selected rows. + */ + ddText : "{0} selected row{1}", + + /** * Called once after all setup has been completed and the grid is ready to be rendered. * @return {Roo.grid.Grid} this @@ -55810,11 +55888,17 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, { getView : function(){ if(!this.view){ this.view = new Roo.grid.GridView(this.viewConfig); + this.view.relayEvents(this, [ + "beforerowremoved", "beforerowsinserted", + "beforerefresh", "rowremoved", + "rowsinserted", "rowupdated" ,"refresh" + ]); } return this.view; }, /** * Called to get grid's drag proxy text, by default returns this.ddText. + * Override this to put something different in the dragged text. * @return {String} */ getDragDropText : function(){ @@ -55822,12 +55906,7 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, { return String.format(this.ddText, count, count == 1 ? '' : 's'); } }); -/** - * Configures the text is the drag proxy (defaults to "%0 selected row(s)"). - * %0 is replaced with the number of selected rows. - * @type String - */ -Roo.grid.Grid.prototype.ddText = "{0} selected row{1}";/* +/* * Based on: * Ext JS Library 1.1.1 * Copyright(c) 2006-2007, Ext JS, LLC. @@ -55925,7 +56004,7 @@ Roo.extend(Roo.grid.AbstractGridView, Roo.util.Observable, { this.splitSelector, cid, " {\n}\n"); } return Roo.util.CSS.createStyleSheet(ruleBuf.join(""), rulesId); - } + } });/* * Based on: * Ext JS Library 1.1.1 @@ -57737,7 +57816,8 @@ Roo.extend(Roo.grid.GridView, Roo.grid.AbstractGridView, { } }, - layout : function(initialRender, is2ndPass){ + layout : function(initialRender, is2ndPass) + { var g = this.grid; var auto = g.autoHeight; var scrollOffset = 16; @@ -57996,7 +58076,12 @@ Roo.extend(Roo.grid.GridDragZone, Roo.dd.DragZone, { } } + if (sm.getSelections && sm.getSelections().length < 1) { + return false; + } + + // before it used to all dragging of unseleted... - now we dont do that. if(rowIndex !== false){ // if editorgrid.. @@ -58017,14 +58102,14 @@ Roo.extend(Roo.grid.GridDragZone, Roo.dd.DragZone, { grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, - selections:sm.getSelections ? sm.getSelections() : ( - sm.getSelectedCell() ? [ this.grid.ds.getAt(sm.getSelectedCell()[0]) ] : [] - ) + selections: sm.getSelections ? sm.getSelections() : ( + sm.getSelectedCell() ? [ this.grid.ds.getAt(sm.getSelectedCell()[0]) ] : []) }; } return false; }, - + + onInitDrag : function(e){ var data = this.dragData; this.ddel.innerHTML = this.grid.getDragDropText();