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