6ece84b9419c7d5b7315eccf52fd54648611fc52
[roojs1] / Roo / bootstrap / Table.js
1 /**
2  * @class Roo.bootstrap.Table
3  * @licence LGBL
4  * @extends Roo.bootstrap.Component
5  * @children Roo.bootstrap.TableBody
6  * Bootstrap Table class.  This class represents the primary interface of a component based grid control.
7  * Similar to Roo.grid.Grid
8  * <pre><code>
9  var table = Roo.factory({
10     xtype : 'Table',
11     xns : Roo.bootstrap,
12     autoSizeColumns: true,
13     
14     
15     store : {
16         xtype : 'Store',
17         xns : Roo.data,
18         remoteSort : true,
19         sortInfo : { direction : 'ASC', field: 'name' },
20         proxy : {
21            xtype : 'HttpProxy',
22            xns : Roo.data,
23            method : 'GET',
24            url : 'https://example.com/some.data.url.json'
25         },
26         reader : {
27            xtype : 'JsonReader',
28            xns : Roo.data,
29            fields : [ 'id', 'name', whatever' ],
30            id : 'id',
31            root : 'data'
32         }
33     },
34     cm : [
35         {
36             xtype : 'ColumnModel',
37             xns : Roo.grid,
38             align : 'center',
39             cursor : 'pointer',
40             dataIndex : 'is_in_group',
41             header : "Name",
42             sortable : true,
43             renderer : function(v, x , r) {  
44             
45                 return String.format("{0}", v)
46             }
47             width : 3
48         } // more columns..
49     ],
50     selModel : {
51         xtype : 'RowSelectionModel',
52         xns : Roo.bootstrap.Table
53         // you can add listeners to catch selection change here....
54     }
55      
56
57  });
58  // set any options
59  grid.render(Roo.get("some-div"));
60 </code></pre>
61
62 Currently the Table  uses multiple headers to try and handle XL / Medium etc... styling
63
64
65
66  *
67  * @cfg {Roo.grid.AbstractSelectionModel} sm The selection model to use (cell selection is not supported yet)
68  * @cfg {Roo.data.Store} store The data store to use
69  * @cfg {Roo.grid.ColumnModel} cm[] A column for the grid.
70  * 
71  * @cfg {String} cls table class
72  *
73  * 
74  * @cfg {boolean} striped Should the rows be alternative striped
75  * @cfg {boolean} bordered Add borders to the table
76  * @cfg {boolean} hover Add hover highlighting
77  * @cfg {boolean} condensed Format condensed
78  * @cfg {boolean} responsive default false - if this is on, columns are rendered with col-xs-4 etc. classes, otherwise columns will be sized by CSS,
79  *                also adds table-responsive (see bootstrap docs for details)
80  * @cfg {Boolean} loadMask (true|false) default false
81  * @cfg {Boolean} footerShow (true|false) generate tfoot, default true
82  * @cfg {Boolean} headerShow (true|false) generate thead, default true
83  * @cfg {Boolean} rowSelection (true|false) default false
84  * @cfg {Boolean} cellSelection (true|false) default false
85  * @cfg {Boolean} scrollBody (true|false) default false - body scrolled / fixed header
86  * @cfg {Roo.bootstrap.PagingToolbar} footer  a paging toolbar
87  * @cfg {Boolean} lazyLoad  auto load data while scrolling to the end (default false)
88  * @cfg {Boolean} auto_hide_footer  auto hide footer if only one page (default false)
89  * @cfg {Boolean} enableColumnResize default true if columns can be resized (drag/drop)
90  * @cfg {Number} minColumnWidth default 50 pixels minimum column width 
91  * 
92  * @constructor
93  * Create a new Table
94  * @param {Object} config The config object
95  */
96
97 Roo.bootstrap.Table = function(config)
98 {
99     Roo.bootstrap.Table.superclass.constructor.call(this, config);
100      
101     // BC...
102     this.rowSelection = (typeof(config.rowSelection) != 'undefined') ? config.rowSelection : this.rowSelection;
103     this.cellSelection = (typeof(config.cellSelection) != 'undefined') ? config.cellSelection : this.cellSelection;
104     this.headerShow = (typeof(config.thead) != 'undefined') ? config.thead : this.headerShow;
105     this.footerShow = (typeof(config.tfoot) != 'undefined') ? config.tfoot : this.footerShow;
106     
107     this.view = this; // compat with grid.
108     
109     this.sm = this.sm || {xtype: 'RowSelectionModel'};
110     if (this.sm) {
111         this.sm.grid = this;
112         this.selModel = Roo.factory(this.sm, Roo.grid);
113         this.sm = this.selModel;
114         this.sm.xmodule = this.xmodule || false;
115     }
116     
117     if (this.cm && typeof(this.cm.config) == 'undefined') {
118         this.colModel = new Roo.grid.ColumnModel(this.cm);
119         this.cm = this.colModel;
120         this.cm.xmodule = this.xmodule || false;
121     }
122     if (this.store) {
123         this.store= Roo.factory(this.store, Roo.data);
124         this.ds = this.store;
125         this.ds.xmodule = this.xmodule || false;
126          
127     }
128     if (this.footer && this.store) {
129         this.footer.dataSource = this.ds;
130         this.footer = Roo.factory(this.footer);
131     }
132     
133     /** @private */
134     this.addEvents({
135         /**
136          * @event cellclick
137          * Fires when a cell is clicked
138          * @param {Roo.bootstrap.Table} this
139          * @param {Roo.Element} el
140          * @param {Number} rowIndex
141          * @param {Number} columnIndex
142          * @param {Roo.EventObject} e
143          */
144         "cellclick" : true,
145         /**
146          * @event celldblclick
147          * Fires when a cell is double clicked
148          * @param {Roo.bootstrap.Table} this
149          * @param {Roo.Element} el
150          * @param {Number} rowIndex
151          * @param {Number} columnIndex
152          * @param {Roo.EventObject} e
153          */
154         "celldblclick" : true,
155         /**
156          * @event rowclick
157          * Fires when a row is clicked
158          * @param {Roo.bootstrap.Table} this
159          * @param {Roo.Element} el
160          * @param {Number} rowIndex
161          * @param {Roo.EventObject} e
162          */
163         "rowclick" : true,
164         /**
165          * @event rowdblclick
166          * Fires when a row is double clicked
167          * @param {Roo.bootstrap.Table} this
168          * @param {Roo.Element} el
169          * @param {Number} rowIndex
170          * @param {Roo.EventObject} e
171          */
172         "rowdblclick" : true,
173         /**
174          * @event mouseover
175          * Fires when a mouseover occur
176          * @param {Roo.bootstrap.Table} this
177          * @param {Roo.Element} el
178          * @param {Number} rowIndex
179          * @param {Number} columnIndex
180          * @param {Roo.EventObject} e
181          */
182         "mouseover" : true,
183         /**
184          * @event mouseout
185          * Fires when a mouseout occur
186          * @param {Roo.bootstrap.Table} this
187          * @param {Roo.Element} el
188          * @param {Number} rowIndex
189          * @param {Number} columnIndex
190          * @param {Roo.EventObject} e
191          */
192         "mouseout" : true,
193         /**
194          * @event rowclass
195          * Fires when a row is rendered, so you can change add a style to it.
196          * @param {Roo.bootstrap.Table} this
197          * @param {Object} rowcfg   contains record  rowIndex colIndex and rowClass - set rowClass to add a style.
198          */
199         'rowclass' : true,
200           /**
201          * @event rowsrendered
202          * Fires when all the  rows have been rendered
203          * @param {Roo.bootstrap.Table} this
204          */
205         'rowsrendered' : true,
206         /**
207          * @event contextmenu
208          * The raw contextmenu event for the entire grid.
209          * @param {Roo.EventObject} e
210          */
211         "contextmenu" : true,
212         /**
213          * @event rowcontextmenu
214          * Fires when a row is right clicked
215          * @param {Roo.bootstrap.Table} this
216          * @param {Number} rowIndex
217          * @param {Roo.EventObject} e
218          */
219         "rowcontextmenu" : true,
220         /**
221          * @event cellcontextmenu
222          * Fires when a cell is right clicked
223          * @param {Roo.bootstrap.Table} this
224          * @param {Number} rowIndex
225          * @param {Number} cellIndex
226          * @param {Roo.EventObject} e
227          */
228          "cellcontextmenu" : true,
229          /**
230          * @event headercontextmenu
231          * Fires when a header is right clicked
232          * @param {Roo.bootstrap.Table} this
233          * @param {Number} columnIndex
234          * @param {Roo.EventObject} e
235          */
236         "headercontextmenu" : true,
237         /**
238          * @event mousedown
239          * The raw mousedown event for the entire grid.
240          * @param {Roo.EventObject} e
241          */
242         "mousedown" : true
243         
244     });
245 };
246
247 Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
248     
249     cls: false,
250     
251     striped : false,
252     scrollBody : false,
253     bordered: false,
254     hover:  false,
255     condensed : false,
256     responsive : false,
257     sm : false,
258     cm : false,
259     store : false,
260     loadMask : false,
261     footerShow : true,
262     headerShow : true,
263     enableColumnResize: true,
264   
265     rowSelection : false,
266     cellSelection : false,
267     layout : false,
268
269     minColumnWidth : 50,
270     
271     // Roo.Element - the tbody
272     bodyEl: false,  // <tbody> Roo.Element - thead element    
273     headEl: false,  // <thead> Roo.Element - thead element
274     resizeProxy : false, // proxy element for dragging?
275
276
277     
278     container: false, // used by gridpanel...
279     
280     lazyLoad : false,
281     
282     CSS : Roo.util.CSS,
283     
284     auto_hide_footer : false,
285     
286     view: false, // actually points to this..
287     
288     getAutoCreate : function()
289     {
290         var cfg = Roo.apply({}, Roo.bootstrap.Table.superclass.getAutoCreate.call(this));
291         
292         cfg = {
293             tag: 'table',
294             cls : 'table', 
295             cn : []
296         };
297         // this get's auto added by panel.Grid
298         if (this.scrollBody) {
299             cfg.cls += ' table-body-fixed';
300         }    
301         if (this.striped) {
302             cfg.cls += ' table-striped';
303         }
304         
305         if (this.hover) {
306             cfg.cls += ' table-hover';
307         }
308         if (this.bordered) {
309             cfg.cls += ' table-bordered';
310         }
311         if (this.condensed) {
312             cfg.cls += ' table-condensed';
313         }
314         
315         if (this.responsive) {
316             cfg.cls += ' table-responsive';
317         }
318         
319         if (this.cls) {
320             cfg.cls+=  ' ' +this.cls;
321         }
322         
323         
324         
325         if (this.layout) {
326             cfg.style = (typeof(cfg.style) == 'undefined') ? ('table-layout:' + this.layout + ';') : (cfg.style + ('table-layout:' + this.layout + ';'));
327         }
328         
329         if(this.store || this.cm){
330             if(this.headerShow){
331                 cfg.cn.push(this.renderHeader());
332             }
333             
334             cfg.cn.push(this.renderBody());
335             
336             if(this.footerShow){
337                 cfg.cn.push(this.renderFooter());
338             }
339             // where does this come from?
340             //cfg.cls+=  ' TableGrid';
341         }
342         
343         return { cn : [ cfg ] };
344     },
345     
346     initEvents : function()
347     {   
348         if(!this.store || !this.cm){
349             return;
350         }
351         if (this.selModel) {
352             this.selModel.initEvents();
353         }
354         
355         
356         //Roo.log('initEvents with ds!!!!');
357         
358         this.bodyEl = this.el.select('tbody', true).first();
359         this.headEl = this.el.select('thead', true).first();
360         this.mainFoot = this.el.select('tfoot', true).first();
361         
362         
363         
364         
365         Roo.each(this.el.select('thead th.sortable', true).elements, function(e){
366             e.on('click', this.sort, this);
367         }, this);
368         
369         
370         // why is this done????? = it breaks dialogs??
371         //this.parent().el.setStyle('position', 'relative');
372         
373         
374         if (this.footer) {
375             this.footer.parentId = this.id;
376             this.footer.onRender(this.el.select('tfoot tr td').first(), null);
377             
378             if(this.lazyLoad){
379                 this.el.select('tfoot tr td').first().addClass('hide');
380             }
381         } 
382         
383         if(this.loadMask) {
384             this.maskEl = new Roo.LoadMask(this.el, { store : this.ds, msgCls: 'roo-el-mask-msg' });
385         }
386         
387         this.store.on('load', this.onLoad, this);
388         this.store.on('beforeload', this.onBeforeLoad, this);
389         this.store.on('update', this.onUpdate, this);
390         this.store.on('add', this.onAdd, this);
391         this.store.on("clear", this.clear, this);
392         
393         this.el.on("contextmenu", this.onContextMenu, this);
394         
395         
396         this.cm.on("headerchange", this.onHeaderChange, this);
397         this.cm.on("hiddenchange", this.onHiddenChange, this, arguments);
398
399  //?? does bodyEl get replaced on render?
400         this.bodyEl.on("click", this.onClick, this);
401         this.bodyEl.on("dblclick", this.onDblClick, this);        
402         this.bodyEl.on('scroll', this.onBodyScroll, this);
403
404         // guessing mainbody will work - this relays usually caught by selmodel at present.
405         this.relayEvents(this.bodyEl, ["mousedown","mouseup","mouseover","mouseout","keypress"]);
406   
407   
408         this.resizeProxy = Roo.get(document.body).createChild({ cls:"x-grid-resize-proxy", html: '&#160;' });
409         
410   
411         if(this.headEl && this.enableColumnResize !== false && Roo.grid.SplitDragZone){
412             new Roo.grid.SplitDragZone(this, this.headEl.dom, false); // not sure what 'lockedHd is for this implementation..)
413         }
414         
415         this.initCSS();
416     },
417     // Compatibility with grid - we implement all the view features at present.
418     getView : function()
419     {
420         return this;
421     },
422     
423     initCSS : function()
424     {
425         
426         
427         var cm = this.cm, styles = [];
428         this.CSS.removeStyleSheet(this.id + '-cssrules');
429         var headHeight = this.headEl ? this.headEl.dom.clientHeight : 0;
430         // we can honour xs/sm/md/xl  as widths...
431         // we first have to decide what widht we are currently at...
432         var sz = Roo.getGridSize();
433         
434         var total = 0;
435         var last = -1;
436         var cols = []; // visable cols.
437         var total_abs = 0;
438         for(var i = 0, len = cm.getColumnCount(); i < len; i++) {
439             var w = cm.getColumnWidth(i, false);
440             if(cm.isHidden(i)){
441                 cols.push( { rel : false, abs : 0 });
442                 continue;
443             }
444             if (w !== false) {
445                 cols.push( { rel : false, abs : w });
446                 total_abs += w;
447                 last = i; // not really..
448                 continue;
449             }
450             var w = cm.getColumnWidth(i, sz);
451             if (w > 0) {
452                 last = i
453             }
454             total += w;
455             cols.push( { rel : w, abs : false });
456         }
457         
458         var avail = this.bodyEl.dom.clientWidth - total_abs;
459         
460         var unitWidth = Math.floor(avail / total);
461         var rem = avail - (unitWidth * total);
462         
463         var hidden, width, pos = 0 , splithide , left;
464         for(var i = 0, len = cm.getColumnCount(); i < len; i++) {
465             
466             hidden = 'display:none;';
467             left = '';
468             width  = 'width:0px;';
469             splithide = '';
470             if(!cm.isHidden(i)){
471                 hidden = '';
472                 
473                 
474                 // we can honour xs/sm/md/xl ?
475                 var w = cols[i].rel == false ? cols[i].abs : (cols[i].rel * unitWidth);
476                 if (w===0) {
477                     hidden = 'display:none;';
478                 }
479                 // width should return a small number...
480                 if (i == last) {
481                     w+=rem; // add the remaining with..
482                 }
483                 pos += w;
484                 left = "left:" + (pos -4) + "px;";
485                 width = "width:" + w+ "px;";
486                 
487             }
488             if (this.responsive) {
489                 width = '';
490                 left = '';
491                 hidden = cm.isHidden(i) ? 'display:none;' : '';
492                 splithide = 'display: none;';
493             }
494             
495             styles.push( '#' , this.id , ' .x-col-' , i, " {", cm.config[i].css, width, hidden, "}\n" );
496             if (this.headEl) {
497                 if (i == last) {
498                     splithide = 'display:none;';
499                 }
500                 
501                 styles.push('#' , this.id , ' .x-hcol-' , i, " { ", width, hidden," }\n",
502                             '#' , this.id , ' .x-grid-split-' , i, " { ", left, splithide,'height:', (headHeight - 4), "px;}\n"
503                 );
504             }
505             
506         }
507         //Roo.log(styles.join(''));
508         this.CSS.createStyleSheet( styles.join(''), this.id + '-cssrules');
509         
510     },
511     
512     
513     
514     onContextMenu : function(e, t)
515     {
516         this.processEvent("contextmenu", e);
517     },
518     
519     processEvent : function(name, e)
520     {
521         if (name != 'touchstart' ) {
522             this.fireEvent(name, e);    
523         }
524         
525         var t = e.getTarget();
526         
527         var cell = Roo.get(t);
528         
529         if(!cell){
530             return;
531         }
532         
533         if(cell.findParent('tfoot', false, true)){
534             return;
535         }
536         
537         if(cell.findParent('thead', false, true)){
538             
539             if(e.getTarget().nodeName.toLowerCase() != 'th'){
540                 cell = Roo.get(t).findParent('th', false, true);
541                 if (!cell) {
542                     Roo.log("failed to find th in thead?");
543                     Roo.log(e.getTarget());
544                     return;
545                 }
546             }
547             
548             var cellIndex = cell.dom.cellIndex;
549             
550             var ename = name == 'touchstart' ? 'click' : name;
551             this.fireEvent("header" + ename, this, cellIndex, e);
552             
553             return;
554         }
555         
556         if(e.getTarget().nodeName.toLowerCase() != 'td'){
557             cell = Roo.get(t).findParent('td', false, true);
558             if (!cell) {
559                 Roo.log("failed to find th in tbody?");
560                 Roo.log(e.getTarget());
561                 return;
562             }
563         }
564         
565         var row = cell.findParent('tr', false, true);
566         var cellIndex = cell.dom.cellIndex;
567         var rowIndex = row.dom.rowIndex - 1;
568         
569         if(row !== false){
570             
571             this.fireEvent("row" + name, this, rowIndex, e);
572             
573             if(cell !== false){
574             
575                 this.fireEvent("cell" + name, this, rowIndex, cellIndex, e);
576             }
577         }
578         
579     },
580     
581     onMouseover : function(e, el)
582     {
583         var cell = Roo.get(el);
584         
585         if(!cell){
586             return;
587         }
588         
589         if(e.getTarget().nodeName.toLowerCase() != 'td'){
590             cell = cell.findParent('td', false, true);
591         }
592         
593         var row = cell.findParent('tr', false, true);
594         var cellIndex = cell.dom.cellIndex;
595         var rowIndex = row.dom.rowIndex - 1; // start from 0
596         
597         this.fireEvent('mouseover', this, cell, rowIndex, cellIndex, e);
598         
599     },
600     
601     onMouseout : function(e, el)
602     {
603         var cell = Roo.get(el);
604         
605         if(!cell){
606             return;
607         }
608         
609         if(e.getTarget().nodeName.toLowerCase() != 'td'){
610             cell = cell.findParent('td', false, true);
611         }
612         
613         var row = cell.findParent('tr', false, true);
614         var cellIndex = cell.dom.cellIndex;
615         var rowIndex = row.dom.rowIndex - 1; // start from 0
616         
617         this.fireEvent('mouseout', this, cell, rowIndex, cellIndex, e);
618         
619     },
620     
621     onClick : function(e, el)
622     {
623         var cell = Roo.get(el);
624         
625         if(!cell || (!this.cellSelection && !this.rowSelection)){
626             return;
627         }
628         
629         if(e.getTarget().nodeName.toLowerCase() != 'td'){
630             cell = cell.findParent('td', false, true);
631         }
632         
633         if(!cell || typeof(cell) == 'undefined'){
634             return;
635         }
636         
637         var row = cell.findParent('tr', false, true);
638         
639         if(!row || typeof(row) == 'undefined'){
640             return;
641         }
642         
643         var cellIndex = cell.dom.cellIndex;
644         var rowIndex = this.getRowIndex(row);
645         
646         // why??? - should these not be based on SelectionModel?
647         //if(this.cellSelection){
648             this.fireEvent('cellclick', this, cell, rowIndex, cellIndex, e);
649         //}
650         
651         //if(this.rowSelection){
652             this.fireEvent('rowclick', this, row, rowIndex, e);
653         //}
654          
655     },
656         
657     onDblClick : function(e,el)
658     {
659         var cell = Roo.get(el);
660         
661         if(!cell || (!this.cellSelection && !this.rowSelection)){
662             return;
663         }
664         
665         if(e.getTarget().nodeName.toLowerCase() != 'td'){
666             cell = cell.findParent('td', false, true);
667         }
668         
669         if(!cell || typeof(cell) == 'undefined'){
670             return;
671         }
672         
673         var row = cell.findParent('tr', false, true);
674         
675         if(!row || typeof(row) == 'undefined'){
676             return;
677         }
678         
679         var cellIndex = cell.dom.cellIndex;
680         var rowIndex = this.getRowIndex(row);
681         
682         if(this.cellSelection){
683             this.fireEvent('celldblclick', this, cell, rowIndex, cellIndex, e);
684         }
685         
686         if(this.rowSelection){
687             this.fireEvent('rowdblclick', this, row, rowIndex, e);
688         }
689     },
690     findRowIndex : function(el)
691     {
692         var cell = Roo.get(el);
693         if(!cell) {
694             return false;
695         }
696         var row = cell.findParent('tr', false, true);
697         
698         if(!row || typeof(row) == 'undefined'){
699             return false;
700         }
701         return this.getRowIndex(row);
702     },
703     sort : function(e,el)
704     {
705         var col = Roo.get(el);
706         
707         if(!col.hasClass('sortable')){
708             return;
709         }
710         
711         var sort = col.attr('sort');
712         var dir = 'ASC';
713         
714         if(col.select('i', true).first().hasClass('fa-arrow-up')){
715             dir = 'DESC';
716         }
717         
718         this.store.sortInfo = {field : sort, direction : dir};
719         
720         if (this.footer) {
721             Roo.log("calling footer first");
722             this.footer.onClick('first');
723         } else {
724         
725             this.store.load({ params : { start : 0 } });
726         }
727     },
728     
729     renderHeader : function()
730     {
731         var header = {
732             tag: 'thead',
733             cn : []
734         };
735         
736         var cm = this.cm;
737         this.totalWidth = 0;
738         
739         for(var i = 0, len = cm.getColumnCount(); i < len; i++){
740             
741             var config = cm.config[i];
742             
743             var c = {
744                 tag: 'th',
745                 cls : 'x-hcol-' + i,
746                 style : '',
747                 
748                 html: cm.getColumnHeader(i)
749             };
750             
751             var tooltip = cm.getColumnTooltip(i);
752             if (tooltip) {
753                 c.tooltip = tooltip;
754             }
755             
756             
757             var hh = '';
758             
759             if(typeof(config.sortable) != 'undefined' && config.sortable){
760                 c.cls += ' sortable';
761                 c.html = '<i class="fa"></i>' + c.html;
762             }
763             
764             // could use BS4 hidden-..-down 
765             
766             if(typeof(config.lgHeader) != 'undefined'){
767                 hh += '<span class="hidden-xs hidden-sm hidden-md ">' + config.lgHeader + '</span>';
768             }
769             
770             if(typeof(config.mdHeader) != 'undefined'){
771                 hh += '<span class="hidden-xs hidden-sm hidden-lg">' + config.mdHeader + '</span>';
772             }
773             
774             if(typeof(config.smHeader) != 'undefined'){
775                 hh += '<span class="hidden-xs hidden-md hidden-lg">' + config.smHeader + '</span>';
776             }
777             
778             if(typeof(config.xsHeader) != 'undefined'){
779                 hh += '<span class="hidden-sm hidden-md hidden-lg">' + config.xsHeader + '</span>';
780             }
781             
782             if(hh.length){
783                 c.html = hh;
784             }
785             
786             if(typeof(config.tooltip) != 'undefined'){
787                 c.tooltip = config.tooltip;
788             }
789             
790             if(typeof(config.colspan) != 'undefined'){
791                 c.colspan = config.colspan;
792             }
793             
794             // hidden is handled by CSS now
795             
796             if(typeof(config.dataIndex) != 'undefined'){
797                 c.sort = config.dataIndex;
798             }
799             
800            
801             
802             if(typeof(config.align) != 'undefined' && config.align.length){
803                 c.style += ' text-align:' + config.align + ';';
804             }
805             
806             /* width is done in CSS
807              *if(typeof(config.width) != 'undefined'){
808                 c.style += ' width:' + config.width + 'px;';
809                 this.totalWidth += config.width;
810             } else {
811                 this.totalWidth += 100; // assume minimum of 100 per column?
812             }
813             */
814             
815             if(typeof(config.cls) != 'undefined'){
816                 c.cls = (typeof(c.cls) == 'undefined') ? config.cls : (c.cls + ' ' + config.cls);
817             }
818             // this is the bit that doesnt reall work at all...
819             
820             if (this.responsive) {
821                  
822             
823                 ['xs','sm','md','lg'].map(function(size){
824                     
825                     if(typeof(config[size]) == 'undefined'){
826                         return;
827                     }
828                      
829                     if (!config[size]) { // 0 = hidden
830                         // BS 4 '0' is treated as hide that column and below.
831                         c.cls += ' hidden-' + size + ' hidden' + size + '-down';
832                         return;
833                     }
834                     
835                     c.cls += ' col-' + size + '-' + config[size] + (
836                         size == 'xs' ? (' col-' + config[size] ) : '' // bs4 col-{num} replaces col-xs
837                     );
838                     
839                     
840                 });
841             }
842             // at the end?
843             
844             c.html +=' <span class="x-grid-split x-grid-split-' + i + '"></span>';
845             
846             
847             
848             
849             header.cn.push(c)
850         }
851         
852         return header;
853     },
854     
855     renderBody : function()
856     {
857         var body = {
858             tag: 'tbody',
859             cn : [
860                 {
861                     tag: 'tr',
862                     cn : [
863                         {
864                             tag : 'td',
865                             colspan :  this.cm.getColumnCount()
866                         }
867                     ]
868                 }
869             ]
870         };
871         
872         return body;
873     },
874     
875     renderFooter : function()
876     {
877         var footer = {
878             tag: 'tfoot',
879             cn : [
880                 {
881                     tag: 'tr',
882                     cn : [
883                         {
884                             tag : 'td',
885                             colspan :  this.cm.getColumnCount()
886                         }
887                     ]
888                 }
889             ]
890         };
891         
892         return footer;
893     },
894     
895     
896     
897     onLoad : function()
898     {
899 //        Roo.log('ds onload');
900         this.clear();
901         
902         var _this = this;
903         var cm = this.cm;
904         var ds = this.store;
905         
906         Roo.each(this.el.select('thead th.sortable', true).elements, function(e){
907             e.select('i', true).removeClass(['fa-arrow-up', 'fa-arrow-down']);
908             if (_this.store.sortInfo) {
909                     
910                 if(e.hasClass('sortable') && e.attr('sort') == _this.store.sortInfo.field && _this.store.sortInfo.direction.toUpperCase() == 'ASC'){
911                     e.select('i', true).addClass(['fa-arrow-up']);
912                 }
913                 
914                 if(e.hasClass('sortable') && e.attr('sort') == _this.store.sortInfo.field && _this.store.sortInfo.direction.toUpperCase() == 'DESC'){
915                     e.select('i', true).addClass(['fa-arrow-down']);
916                 }
917             }
918         });
919         
920         var tbody =  this.bodyEl;
921               
922         if(ds.getCount() > 0){
923             ds.data.each(function(d,rowIndex){
924                 var row =  this.renderRow(cm, ds, rowIndex);
925                 
926                 tbody.createChild(row);
927                 
928                 var _this = this;
929                 
930                 if(row.cellObjects.length){
931                     Roo.each(row.cellObjects, function(r){
932                         _this.renderCellObject(r);
933                     })
934                 }
935                 
936             }, this);
937         }
938         
939         var tfoot = this.el.select('tfoot', true).first();
940         
941         if(this.footerShow && this.auto_hide_footer && this.mainFoot){
942             
943             this.mainFoot.setVisibilityMode(Roo.Element.DISPLAY).hide();
944             
945             var total = this.ds.getTotalCount();
946             
947             if(this.footer.pageSize < total){
948                 this.mainFoot.show();
949             }
950         }
951         
952         Roo.each(this.el.select('tbody td', true).elements, function(e){
953             e.on('mouseover', _this.onMouseover, _this);
954         });
955         
956         Roo.each(this.el.select('tbody td', true).elements, function(e){
957             e.on('mouseout', _this.onMouseout, _this);
958         });
959         this.fireEvent('rowsrendered', this);
960         
961         this.autoSize();
962         
963         this.initCSS(); /// resize cols
964
965         
966     },
967     
968     
969     onUpdate : function(ds,record)
970     {
971         this.refreshRow(record);
972         this.autoSize();
973     },
974     
975     onRemove : function(ds, record, index, isUpdate){
976         if(isUpdate !== true){
977             this.fireEvent("beforerowremoved", this, index, record);
978         }
979         var bt = this.bodyEl.dom;
980         
981         var rows = this.el.select('tbody > tr', true).elements;
982         
983         if(typeof(rows[index]) != 'undefined'){
984             bt.removeChild(rows[index].dom);
985         }
986         
987 //        if(bt.rows[index]){
988 //            bt.removeChild(bt.rows[index]);
989 //        }
990         
991         if(isUpdate !== true){
992             //this.stripeRows(index);
993             //this.syncRowHeights(index, index);
994             //this.layout();
995             this.fireEvent("rowremoved", this, index, record);
996         }
997     },
998     
999     onAdd : function(ds, records, rowIndex)
1000     {
1001         //Roo.log('on Add called');
1002         // - note this does not handle multiple adding very well..
1003         var bt = this.bodyEl.dom;
1004         for (var i =0 ; i < records.length;i++) {
1005             //Roo.log('call insert row Add called on ' + rowIndex + ':' + i);
1006             //Roo.log(records[i]);
1007             //Roo.log(this.store.getAt(rowIndex+i));
1008             this.insertRow(this.store, rowIndex + i, false);
1009             return;
1010         }
1011         
1012     },
1013     
1014     
1015     refreshRow : function(record){
1016         var ds = this.store, index;
1017         if(typeof record == 'number'){
1018             index = record;
1019             record = ds.getAt(index);
1020         }else{
1021             index = ds.indexOf(record);
1022             if (index < 0) {
1023                 return; // should not happen - but seems to 
1024             }
1025         }
1026         this.insertRow(ds, index, true);
1027         this.autoSize();
1028         this.onRemove(ds, record, index+1, true);
1029         this.autoSize();
1030         //this.syncRowHeights(index, index);
1031         //this.layout();
1032         this.fireEvent("rowupdated", this, index, record);
1033     },
1034     // private - called by RowSelection
1035     onRowSelect : function(rowIndex){
1036         var row = this.getRowDom(rowIndex);
1037         row.addClass(['bg-info','info']);
1038     },
1039     // private - called by RowSelection
1040     onRowDeselect : function(rowIndex)
1041     {
1042         if (rowIndex < 0) {
1043             return;
1044         }
1045         var row = this.getRowDom(rowIndex);
1046         row.removeClass(['bg-info','info']);
1047     },
1048       /**
1049      * Focuses the specified row.
1050      * @param {Number} row The row index
1051      */
1052     focusRow : function(row)
1053     {
1054         //Roo.log('GridView.focusRow');
1055         var x = this.bodyEl.dom.scrollLeft;
1056         this.focusCell(row, 0, false);
1057         this.bodyEl.dom.scrollLeft = x;
1058
1059     },
1060      /**
1061      * Focuses the specified cell.
1062      * @param {Number} row The row index
1063      * @param {Number} col The column index
1064      * @param {Boolean} hscroll false to disable horizontal scrolling
1065      */
1066     focusCell : function(row, col, hscroll)
1067     {
1068         //Roo.log('GridView.focusCell');
1069         var el = this.ensureVisible(row, col, hscroll);
1070         // not sure what focusEL achives = it's a <a> pos relative 
1071         //this.focusEl.alignTo(el, "tl-tl");
1072         //if(Roo.isGecko){
1073         //    this.focusEl.focus();
1074         //}else{
1075         //    this.focusEl.focus.defer(1, this.focusEl);
1076         //}
1077     },
1078     
1079      /**
1080      * Scrolls the specified cell into view
1081      * @param {Number} row The row index
1082      * @param {Number} col The column index
1083      * @param {Boolean} hscroll false to disable horizontal scrolling
1084      */
1085     ensureVisible : function(row, col, hscroll)
1086     {
1087         //Roo.log('GridView.ensureVisible,' + row + ',' + col);
1088         //return null; //disable for testing.
1089         if(typeof row != "number"){
1090             row = row.rowIndex;
1091         }
1092         if(row < 0 && row >= this.ds.getCount()){
1093             return  null;
1094         }
1095         col = (col !== undefined ? col : 0);
1096         var cm = this.cm;
1097         while(cm.isHidden(col)){
1098             col++;
1099         }
1100
1101         var el = this.getCellDom(row, col);
1102         if(!el){
1103             return null;
1104         }
1105         var c = this.bodyEl.dom;
1106
1107         var ctop = parseInt(el.offsetTop, 10);
1108         var cleft = parseInt(el.offsetLeft, 10);
1109         var cbot = ctop + el.offsetHeight;
1110         var cright = cleft + el.offsetWidth;
1111
1112         //var ch = c.clientHeight - this.mainHd.dom.offsetHeight;
1113         var ch = 0; //?? header is not withing the area?
1114         var stop = parseInt(c.scrollTop, 10);
1115         var sleft = parseInt(c.scrollLeft, 10);
1116         var sbot = stop + ch;
1117         var sright = sleft + c.clientWidth;
1118         /*
1119         Roo.log('GridView.ensureVisible:' +
1120                 ' ctop:' + ctop +
1121                 ' c.clientHeight:' + c.clientHeight +
1122                 ' this.mainHd.dom.offsetHeight:' + this.mainHd.dom.offsetHeight +
1123                 ' stop:' + stop +
1124                 ' cbot:' + cbot +
1125                 ' sbot:' + sbot +
1126                 ' ch:' + ch  
1127                 );
1128         */
1129         if(ctop < stop){
1130             c.scrollTop = ctop;
1131             //Roo.log("set scrolltop to ctop DISABLE?");
1132         }else if(cbot > sbot){
1133             //Roo.log("set scrolltop to cbot-ch");
1134             c.scrollTop = cbot-ch;
1135         }
1136
1137         if(hscroll !== false){
1138             if(cleft < sleft){
1139                 c.scrollLeft = cleft;
1140             }else if(cright > sright){
1141                 c.scrollLeft = cright-c.clientWidth;
1142             }
1143         }
1144
1145         return el;
1146     },
1147     
1148     
1149     insertRow : function(dm, rowIndex, isUpdate){
1150         
1151         if(!isUpdate){
1152             this.fireEvent("beforerowsinserted", this, rowIndex);
1153         }
1154             //var s = this.getScrollState();
1155         var row = this.renderRow(this.cm, this.store, rowIndex);
1156         // insert before rowIndex..
1157         var e = this.bodyEl.createChild(row,this.getRowDom(rowIndex));
1158         
1159         var _this = this;
1160                 
1161         if(row.cellObjects.length){
1162             Roo.each(row.cellObjects, function(r){
1163                 _this.renderCellObject(r);
1164             })
1165         }
1166             
1167         if(!isUpdate){
1168             this.fireEvent("rowsinserted", this, rowIndex);
1169             //this.syncRowHeights(firstRow, lastRow);
1170             //this.stripeRows(firstRow);
1171             //this.layout();
1172         }
1173         
1174     },
1175     
1176     
1177     getRowDom : function(rowIndex)
1178     {
1179         var rows = this.el.select('tbody > tr', true).elements;
1180         
1181         return (typeof(rows[rowIndex]) == 'undefined') ? false : rows[rowIndex];
1182         
1183     },
1184     getCellDom : function(rowIndex, colIndex)
1185     {
1186         var row = this.getRowDom(rowIndex);
1187         if (row === false) {
1188             return false;
1189         }
1190         var cols = row.select('td', true).elements;
1191         return (typeof(cols[colIndex]) == 'undefined') ? false : cols[colIndex];
1192         
1193     },
1194     
1195     // returns the object tree for a tr..
1196   
1197     
1198     renderRow : function(cm, ds, rowIndex) 
1199     {
1200         var d = ds.getAt(rowIndex);
1201         
1202         var row = {
1203             tag : 'tr',
1204             cls : 'x-row-' + rowIndex,
1205             cn : []
1206         };
1207             
1208         var cellObjects = [];
1209         
1210         for(var i = 0, len = cm.getColumnCount(); i < len; i++){
1211             var config = cm.config[i];
1212             
1213             var renderer = cm.getRenderer(i);
1214             var value = '';
1215             var id = false;
1216             
1217             if(typeof(renderer) !== 'undefined'){
1218                 value = renderer(d.data[cm.getDataIndex(i)], false, d);
1219             }
1220             // if object are returned, then they are expected to be Roo.bootstrap.Component instances
1221             // and are rendered into the cells after the row is rendered - using the id for the element.
1222             
1223             if(typeof(value) === 'object'){
1224                 id = Roo.id();
1225                 cellObjects.push({
1226                     container : id,
1227                     cfg : value 
1228                 })
1229             }
1230             
1231             var rowcfg = {
1232                 record: d,
1233                 rowIndex : rowIndex,
1234                 colIndex : i,
1235                 rowClass : ''
1236             };
1237
1238             this.fireEvent('rowclass', this, rowcfg);
1239             
1240             var td = {
1241                 tag: 'td',
1242                 // this might end up displaying HTML?
1243                 // this is too messy... - better to only do it on columsn you know are going to be too long
1244                 //tooltip : (typeof(value) === 'object') ? '' : value,
1245                 cls : rowcfg.rowClass + ' x-col-' + i,
1246                 style: '',
1247                 html: (typeof(value) === 'object') ? '' : value
1248             };
1249             
1250             if (id) {
1251                 td.id = id;
1252             }
1253             
1254             if(typeof(config.colspan) != 'undefined'){
1255                 td.colspan = config.colspan;
1256             }
1257             
1258             
1259             
1260             if(typeof(config.align) != 'undefined' && config.align.length){
1261                 td.style += ' text-align:' + config.align + ';';
1262             }
1263             if(typeof(config.valign) != 'undefined' && config.valign.length){
1264                 td.style += ' vertical-align:' + config.valign + ';';
1265             }
1266             /*
1267             if(typeof(config.width) != 'undefined'){
1268                 td.style += ' width:' +  config.width + 'px;';
1269             }
1270             */
1271             
1272             if(typeof(config.cursor) != 'undefined'){
1273                 td.style += ' cursor:' +  config.cursor + ';';
1274             }
1275             
1276             if(typeof(config.cls) != 'undefined'){
1277                 td.cls = (typeof(td.cls) == 'undefined') ? config.cls : (td.cls + ' ' + config.cls);
1278             }
1279             if (this.responsive) {
1280                 ['xs','sm','md','lg'].map(function(size){
1281                     
1282                     if(typeof(config[size]) == 'undefined'){
1283                         return;
1284                     }
1285                     
1286                     
1287                       
1288                     if (!config[size]) { // 0 = hidden
1289                         // BS 4 '0' is treated as hide that column and below.
1290                         td.cls += ' hidden-' + size + ' hidden' + size + '-down';
1291                         return;
1292                     }
1293                     
1294                     td.cls += ' col-' + size + '-' + config[size] + (
1295                         size == 'xs' ? (' col-' +   config[size] ) : '' // bs4 col-{num} replaces col-xs
1296                     );
1297                      
1298     
1299                 });
1300             }
1301             row.cn.push(td);
1302            
1303         }
1304         
1305         row.cellObjects = cellObjects;
1306         
1307         return row;
1308           
1309     },
1310     
1311     
1312     
1313     onBeforeLoad : function()
1314     {
1315         
1316     },
1317      /**
1318      * Remove all rows
1319      */
1320     clear : function()
1321     {
1322         this.el.select('tbody', true).first().dom.innerHTML = '';
1323     },
1324     /**
1325      * Show or hide a row.
1326      * @param {Number} rowIndex to show or hide
1327      * @param {Boolean} state hide
1328      */
1329     setRowVisibility : function(rowIndex, state)
1330     {
1331         var bt = this.bodyEl.dom;
1332         
1333         var rows = this.el.select('tbody > tr', true).elements;
1334         
1335         if(typeof(rows[rowIndex]) == 'undefined'){
1336             return;
1337         }
1338         rows[rowIndex][ state ? 'removeClass' : 'addClass']('d-none');
1339         
1340     },
1341     
1342     
1343     getSelectionModel : function(){
1344         if(!this.selModel){
1345             this.selModel = new Roo.bootstrap.Table.RowSelectionModel({grid: this});
1346         }
1347         return this.selModel;
1348     },
1349     /*
1350      * Render the Roo.bootstrap object from renderder
1351      */
1352     renderCellObject : function(r)
1353     {
1354         var _this = this;
1355         
1356         r.cfg.parentId = (typeof(r.container) == 'string') ? r.container : r.container.id;
1357         
1358         var t = r.cfg.render(r.container);
1359         
1360         if(r.cfg.cn){
1361             Roo.each(r.cfg.cn, function(c){
1362                 var child = {
1363                     container: t.getChildContainer(),
1364                     cfg: c
1365                 };
1366                 _this.renderCellObject(child);
1367             })
1368         }
1369     },
1370     /**
1371      * get the Row Index from a dom element.
1372      * @param {Roo.Element} row The row to look for
1373      * @returns {Number} the row
1374      */
1375     getRowIndex : function(row)
1376     {
1377         var rowIndex = -1;
1378         
1379         Roo.each(this.el.select('tbody > tr', true).elements, function(el, index){
1380             if(el != row){
1381                 return;
1382             }
1383             
1384             rowIndex = index;
1385         });
1386         
1387         return rowIndex;
1388     },
1389     /**
1390      * get the header TH element for columnIndex
1391      * @param {Number} columnIndex
1392      * @returns {Roo.Element}
1393      */
1394     getHeaderIndex: function(colIndex)
1395     {
1396         var cols = this.headEl.select('th', true).elements;
1397         return cols[colIndex]; 
1398     },
1399     /**
1400      * get the Column Index from a dom element. (using regex on x-hcol-{colid})
1401      * @param {domElement} cell to look for
1402      * @returns {Number} the column
1403      */
1404     getCellIndex : function(cell)
1405     {
1406         var id = String(cell.className).match(Roo.bootstrap.Table.cellRE);
1407         if(id){
1408             return parseInt(id[1], 10);
1409         }
1410         return 0;
1411     },
1412      /**
1413      * Returns the grid's underlying element = used by panel.Grid
1414      * @return {Element} The element
1415      */
1416     getGridEl : function(){
1417         return this.el;
1418     },
1419      /**
1420      * Forces a resize - used by panel.Grid
1421      * @return {Element} The element
1422      */
1423     autoSize : function()
1424     {
1425         //var ctr = Roo.get(this.container.dom.parentElement);
1426         var ctr = Roo.get(this.el.dom);
1427         
1428         var thd = this.getGridEl().select('thead',true).first();
1429         var tbd = this.getGridEl().select('tbody', true).first();
1430         var tfd = this.getGridEl().select('tfoot', true).first();
1431         
1432         var cw = ctr.getWidth();
1433         this.getGridEl().select('tfoot tr, tfoot  td',true).setWidth(cw);
1434         
1435         if (tbd) {
1436             
1437             tbd.setWidth(ctr.getWidth());
1438             // if the body has a max height - and then scrolls - we should perhaps set up the height here
1439             // this needs fixing for various usage - currently only hydra job advers I think..
1440             //tdb.setHeight(
1441             //        ctr.getHeight() - ((thd ? thd.getHeight() : 0) + (tfd ? tfd.getHeight() : 0))
1442             //); 
1443             var barsize = (tbd.dom.offsetWidth - tbd.dom.clientWidth);
1444             cw -= barsize;
1445         }
1446         cw = Math.max(cw, this.totalWidth);
1447         this.getGridEl().select('tbody tr',true).setWidth(cw);
1448         this.initCSS();
1449         
1450         // resize 'expandable coloumn?
1451         
1452         return; // we doe not have a view in this design..
1453         
1454     },
1455     onBodyScroll: function()
1456     {
1457         //Roo.log("body scrolled');" + this.bodyEl.dom.scrollLeft);
1458         if(this.headEl){
1459             this.headEl.setStyle({
1460                 'position' : 'relative',
1461                 'left': (-1* this.bodyEl.dom.scrollLeft) + 'px'
1462             });
1463         }
1464         
1465         if(this.lazyLoad){
1466             
1467             var scrollHeight = this.bodyEl.dom.scrollHeight;
1468             
1469             var scrollTop = Math.ceil(this.bodyEl.getScroll().top);
1470             
1471             var height = this.bodyEl.getHeight();
1472             
1473             if(scrollHeight - height == scrollTop) {
1474                 
1475                 var total = this.ds.getTotalCount();
1476                 
1477                 if(this.footer.cursor + this.footer.pageSize < total){
1478                     
1479                     this.footer.ds.load({
1480                         params : {
1481                             start : this.footer.cursor + this.footer.pageSize,
1482                             limit : this.footer.pageSize
1483                         },
1484                         add : true
1485                     });
1486                 }
1487             }
1488             
1489         }
1490     },
1491     onColumnSplitterMoved : function(i, diff)
1492     {
1493         this.userResized = true;
1494         
1495         var cm = this.colModel;
1496         
1497         var w = this.getHeaderIndex(i).getWidth() + diff;
1498         
1499         
1500         cm.setColumnWidth(i, w, true);
1501         this.initCSS();
1502         //var cid = cm.getColumnId(i); << not used in this version?
1503        /* Roo.log(['#' + this.id + ' .x-col-' + i, "width", w + "px"]);
1504         
1505         this.CSS.updateRule( '#' + this.id + ' .x-col-' + i, "width", w + "px");
1506         this.CSS.updateRule('#' + this.id + ' .x-hcol-' + i, "width", w + "px");
1507         this.CSS.updateRule('#' + this.id + ' .x-grid-split-' + i, "left", w + "px");
1508 */
1509         //this.updateSplitters();
1510         //this.layout(); << ??
1511         this.fireEvent("columnresize", i, w);
1512     },
1513     onHeaderChange : function()
1514     {
1515         var header = this.renderHeader();
1516         var table = this.el.select('table', true).first();
1517         
1518         this.headEl.remove();
1519         this.headEl = table.createChild(header, this.bodyEl, false);
1520         
1521         Roo.each(this.el.select('thead th.sortable', true).elements, function(e){
1522             e.on('click', this.sort, this);
1523         }, this);
1524         
1525         if(this.enableColumnResize !== false && Roo.grid.SplitDragZone){
1526             new Roo.grid.SplitDragZone(this, this.headEl.dom, false); // not sure what 'lockedHd is for this implementation..)
1527         }
1528         
1529     },
1530     
1531     onHiddenChange : function(colModel, colIndex, hidden)
1532     {
1533         /*
1534         this.cm.setHidden()
1535         var thSelector = '#' + this.id + ' .x-hcol-' + colIndex;
1536         var tdSelector = '#' + this.id + ' .x-col-' + colIndex;
1537         
1538         this.CSS.updateRule(thSelector, "display", "");
1539         this.CSS.updateRule(tdSelector, "display", "");
1540         
1541         if(hidden){
1542             this.CSS.updateRule(thSelector, "display", "none");
1543             this.CSS.updateRule(tdSelector, "display", "none");
1544         }
1545         */
1546         // onload calls initCSS()
1547         this.onHeaderChange();
1548         this.onLoad();
1549     },
1550     
1551     setColumnWidth: function(col_index, width)
1552     {
1553         // width = "md-2 xs-2..."
1554         if(!this.colModel.config[col_index]) {
1555             return;
1556         }
1557         
1558         var w = width.split(" ");
1559         
1560         var rows = this.el.dom.getElementsByClassName("x-col-"+col_index);
1561         
1562         var h_row = this.el.dom.getElementsByClassName("x-hcol-"+col_index);
1563         
1564         
1565         for(var j = 0; j < w.length; j++) {
1566             
1567             if(!w[j]) {
1568                 continue;
1569             }
1570             
1571             var size_cls = w[j].split("-");
1572             
1573             if(!Number.isInteger(size_cls[1] * 1)) {
1574                 continue;
1575             }
1576             
1577             if(!this.colModel.config[col_index][size_cls[0]]) {
1578                 continue;
1579             }
1580             
1581             if(!h_row[0].classList.contains("col-"+size_cls[0]+"-"+this.colModel.config[col_index][size_cls[0]])) {
1582                 continue;
1583             }
1584             
1585             h_row[0].classList.replace(
1586                 "col-"+size_cls[0]+"-"+this.colModel.config[col_index][size_cls[0]],
1587                 "col-"+size_cls[0]+"-"+size_cls[1]
1588             );
1589             
1590             for(var i = 0; i < rows.length; i++) {
1591                 
1592                 var size_cls = w[j].split("-");
1593                 
1594                 if(!Number.isInteger(size_cls[1] * 1)) {
1595                     continue;
1596                 }
1597                 
1598                 if(!this.colModel.config[col_index][size_cls[0]]) {
1599                     continue;
1600                 }
1601                 
1602                 if(!rows[i].classList.contains("col-"+size_cls[0]+"-"+this.colModel.config[col_index][size_cls[0]])) {
1603                     continue;
1604                 }
1605                 
1606                 rows[i].classList.replace(
1607                     "col-"+size_cls[0]+"-"+this.colModel.config[col_index][size_cls[0]],
1608                     "col-"+size_cls[0]+"-"+size_cls[1]
1609                 );
1610             }
1611             
1612             this.colModel.config[col_index][size_cls[0]] = size_cls[1];
1613         }
1614     }
1615 });
1616
1617 // currently only used to find the split on drag.. 
1618 Roo.bootstrap.Table.cellRE = /(?:.*?)x-grid-(?:hd|cell|split)-([\d]+)(?:.*?)/;
1619
1620 /**
1621  * @depricated
1622 */
1623 Roo.bootstrap.Table.AbstractSelectionModel = Roo.grid.AbstractSelectionModel;
1624 Roo.bootstrap.Table.RowSelectionModel = Roo.grid.RowSelectionModel;