X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/examples/ux/RowEditor.js diff --git a/examples/ux/RowEditor.js b/examples/ux/RowEditor.js index 70014f82..9076f414 100644 --- a/examples/ux/RowEditor.js +++ b/examples/ux/RowEditor.js @@ -1,6 +1,6 @@ /*! - * Ext JS Library 3.1.0 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.1.1 + * Copyright(c) 2006-2010 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ @@ -8,11 +8,11 @@ Ext.ns('Ext.ux.grid'); /** * @class Ext.ux.grid.RowEditor - * @extends Ext.Panel + * @extends Ext.Panel * Plugin (ptype = 'roweditor') that adds the ability to rapidly edit full rows in a grid. * A validation mode may be enabled which uses AnchorTips to notify the user of all * validation errors at once. - * + * * @ptype roweditor */ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { @@ -29,7 +29,7 @@ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { monitorValid: true, focusDelay: 250, errorSummary: true, - + saveText: 'Save', cancelText: 'Cancel', commitChangesText: 'You need to commit or cancel your changes', @@ -54,7 +54,7 @@ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { * @event canceledit * Fired when the editor is cancelled. * @param {Ext.ux.grid.RowEditor} roweditor This object - * @param {Boolean} forced True if the cancel button is pressed, false is the editor was invalid. + * @param {Boolean} forced True if the cancel button is pressed, false is the editor was invalid. */ 'canceledit', /** @@ -103,8 +103,8 @@ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { columnresize: this.verifyLayout, columnmove: this.refreshFields, reconfigure: this.refreshFields, - beforedestroy : this.beforedestroy, - destroy : this.destroy, + beforedestroy : this.beforedestroy, + destroy : this.destroy, bodyscroll: { buffer: 250, fn: this.positionButtons @@ -149,7 +149,7 @@ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { var g = this.grid, view = g.getView(), row = view.getRow(rowIndex), record = g.store.getAt(rowIndex); - + this.record = record; this.rowIndex = rowIndex; this.values = {}; @@ -193,10 +193,10 @@ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { this.fireEvent('canceledit', this, saveChanges === false); return; } - var changes = {}, - r = this.record, + var changes = {}, + r = this.record, hasChange = false, - cm = this.grid.colModel, + cm = this.grid.colModel, fields = this.items.items; for(var i = 0, len = cm.getColumnCount(); i < len; i++){ if(!cm.isHidden(i)){ @@ -225,7 +225,7 @@ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { verifyLayout: function(force){ if(this.el && (this.isVisible() || force === true)){ var row = this.grid.getView().getRow(this.rowIndex); - this.setSize(Ext.fly(row).getWidth(), Ext.fly(row).getHeight() + 9); + this.setSize(Ext.fly(row).getWidth(), Ext.isIE ? Ext.fly(row).getHeight() + 9 : undefined); var cm = this.grid.colModel, fields = this.items.items; for(var i = 0, len = cm.getColumnCount(); i < len; i++){ if(!cm.isHidden(i)){ @@ -258,6 +258,8 @@ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { ed = c.getEditor(); if(!ed){ ed = c.displayEditor || new Ext.form.DisplayField(); + }else{ + ed = ed.field; } if(i == 0){ ed.margins = pm('0 1 2 1'); @@ -373,7 +375,7 @@ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { scroll = view.scroller.dom.scrollLeft, bw = this.btns.getWidth(), width = Math.min(g.getWidth(), g.getColumnModel().getTotalWidth()); - + this.btns.el.shift({left: (width/2)-(bw/2)+scroll, top: h - 2, stopFx: true, duration:0.2}); } }, @@ -393,14 +395,16 @@ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { if(this.isVisible()){ var index = 0, cm = this.grid.getColumnModel(), - c; + c, + ed; if(pt){ index = this.getTargetColumnIndex(pt); } for(var i = index||0, len = cm.getColumnCount(); i < len; i++){ c = cm.getColumnAt(i); - if(!c.hidden && c.getEditor()){ - c.getEditor().focus(); + ed = c.getEditor(); + if(!c.hidden && ed){ + ed.field.focus(); break; } } @@ -408,11 +412,11 @@ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { }, getTargetColumnIndex: function(pt){ - var grid = this.grid, + var grid = this.grid, v = grid.view, x = pt.left, cms = grid.colModel.config, - i = 0, + i = 0, match = false; for(var len = cms.length, c; c = cms[i]; i++){ if(!c.hidden){ @@ -485,7 +489,7 @@ Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, { top = parseInt(this.el.dom.style.top, 10), scroll = v.scroller.dom.scrollTop, h = this.el.getHeight(); - + if(top + h >= scroll){ t.initTarget(this.items.last().getEl()); if(!t.rendered){