1 // <script type="text/javascript">
2 /* this knocks about 3000ms off the startup - total is 13000 originally. */
8 camelRe = /(-[a-z])/gi,
10 view = document.defaultView,
11 propFloat = Ext.isIE ? 'styleFloat' : 'cssFloat',
12 opacityRe = /alpha\(opacity=(.*)\)/i;
13 Ext.propCache = propCache;
15 function camelFn (a) {
16 return a.charAt(1).toUpperCase();
18 function chkCache(prop){
19 return propCache[prop] ||
20 (propCache[prop] = prop == 'float' ?
21 propFloat : prop.replace(camelRe, camelFn));
23 Ext.override(Ext.Element, {
24 getStyle : function(){
25 return view && view.getComputedStyle ?
28 var el = this.dom, v, cs;
29 if(el == document) return null;
30 prop = chkCache(prop);
32 return (v = el.style[prop]) ? v :
33 (cs = view.getComputedStyle(el, '')) ?
37 var el = this.dom, m, cs;
38 if(el == document) return null;
39 if (prop == 'opacity') {
40 if (el.style.filter.match) {
41 if(m = el.style.filter.match(opacityRe)){
42 var fv = parseFloat(m[1]);
44 return fv ? fv / 100 : 0;
50 prop = chkCache(prop);
51 return el.style[prop] || ((cs = el.currentStyle) ? cs[prop] : null);
54 setStyle : function(prop, value){
58 if (typeof(prop) != 'object') {
66 this.setOpacity(value) :
67 this.dom.style[chkCache(style)] = value;
76 Ext.override(Ext.dd.StatusProxy, {
77 update : function(html){
78 if(typeof html == 'string'){
79 this.ghost.update(html);
81 this.ghost.update('');
82 html.style.margin = '0';
83 this.ghost.dom.appendChild(html);
85 var el = this.ghost.dom.firstChild;
87 Ext.fly(el).setStyle('float', 'none');
93 Ext.override(Ext.grid.ColumnModel, {
96 getIndexByDataIndex : function(x){ // fixme - find refs and remove them!
97 return this.findColumnIndex(x);
101 Ext.override(Ext.grid.GridView, {
103 updateColumns : function(){ // this was added before I worked out the fix to the cols.
104 this.grid.stopEditing();
105 var cm = this.grid.colModel, colIds = this.getColumnIds();
106 //var totalWidth = cm.getTotalWidth();
110 for(var i = 0, len = cm.getColumnCount(); i < len; i++){
111 //if(cm.isHidden(i)) continue;
112 w = cm.getColumnWidth(i);
113 ci = Roo.isSafari ? colIds[i].toLowerCase() : colIds[i];
114 // console.log('UPDATE COLS: " +this.colSelector+colIds[i] + '=>' + (w - this.borderWidth)+ "px");
115 this.css.updateRule(this.colSelector+ci, 'width', (w - this.borderWidth) + 'px');
117 this.css.updateRule(this.hdSelector+ci, 'width', (w - this.borderWidth) + 'px');
119 this.updateSplitters();
120 // this.forceLayout.defer(100,this);
129 String.format = function(format) {
130 var args = Array.prototype.slice.call(arguments, 1);
131 return format.replace(/\{(\d+)\}/g, function(m, i) {
133 var e = document.createTextNode( args[i] );
134 var ew = document.createElement('a');
140 Ext.grid.ColumnModel.defaultRenderer = function(value){
141 if (typeof value == 'undefined') {
144 if (typeof value == 'string' && value.length < 1){
147 //console.log(value);
148 return String.format('{0}',value);
151 // as 'findbyId in roo...
152 Ext.form.Form.prototype.stackFind = function(id)
154 return this.findbyId(id);
159 Ext.form.Hidden = function(config){
160 Ext.form.Hidden.superclass.constructor.call(this, config);
163 Ext.extend(Ext.form.Hidden, Ext.form.TextField, {
171 itemCls : 'x-form-item-display-none'
175 Ext.form.DateField.prototype.getValue = function(fmt) {
176 var r = this.parseDate(Ext.form.DateField.superclass.getValue.call(this)) || '';
177 if (typeof(fmt) == 'undefined') {
180 if (typeof(r) == 'string') {
183 return r.format(fmt);
186 //<script type="text/Javascript">
189 * @class Ext.form.FormButton
190 * @extends Ext.Button
191 * Single checkbox field. Can be used as a direct replacement for traditional checkbox fields.
193 * Creates a new Checkbox
194 * @param {Object} config Configuration options
197 Ext.form.FormButton = function(config){
198 this.config = config;
199 Ext.form.FormButton.superclass.constructor.call(this, config);
203 Ext.extend(Ext.form.FormButton, Ext.form.Field, {
206 defaultAutoCreate : { tag: 'input', type: 'hidden'},
207 onRender : function(ct, position){
208 Roo.form.Checkbox.superclass.onRender.call(this, ct, position);
210 var p = Ext.get(this.container.findParentNode('div'));
211 var ch = p.child('label');
217 var bc = this.container.createChild({ tag : 'div' });
219 new Ext.Button(bc, this.config);
226 Roo.Toolbar.prototype.hide = function()
228 this.el.child('div').setVisibilityMode(Roo.Element.DISPLAY);
229 this.el.child('div').hide();
231 Roo.Toolbar.prototype.show = function()
233 this.el.child('div').show();
236 /* what's this for??? - I think to add x-toolbar-td - is it needed???*/
237 Roo.Toolbar.prototype.nextBlock = function(){
239 var td = document.createElement('td');
240 this.tr.appendChild(td);
241 td.className = 'x-toolbar-td';