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