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