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