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