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