X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775..6e39d509471fe9b4e2660e0d1631b350d0c66f40:/examples/treegrid/tree-grid.js diff --git a/examples/treegrid/tree-grid.js b/examples/treegrid/tree-grid.js new file mode 100644 index 00000000..c2cb2f38 --- /dev/null +++ b/examples/treegrid/tree-grid.js @@ -0,0 +1,47 @@ +/*! + * Ext JS Library 3.1.0 + * Copyright(c) 2006-2009 Ext JS, LLC + * licensing@extjs.com + * http://www.extjs.com/license + */ +Ext.onReady(function() { + Ext.QuickTips.init(); + + var tree = new Ext.ux.tree.TreeGrid({ + title: 'Core Team Projects', + width: 500, + height: 300, + renderTo: Ext.getBody(), + enableDD: true, + + columns:[{ + header: 'Task', + dataIndex: 'task', + width: 230 + },{ + header: 'Duration', + width: 100, + dataIndex: 'duration', + align: 'center', + sortType: 'asFloat', + tpl: new Ext.XTemplate('{duration:this.formatHours}', { + formatHours: function(v) { + if(v < 1) { + return Math.round(v * 60) + ' mins'; + } else if (Math.floor(v) !== v) { + var min = v - Math.floor(v); + return Math.floor(v) + 'h ' + Math.round(min * 60) + 'm'; + } else { + return v + ' hour' + (v === 1 ? '' : 's'); + } + } + }) + },{ + header: 'Assigned To', + width: 150, + dataIndex: 'user' + }], + + dataUrl: 'treegrid-data.json' + }); +}); \ No newline at end of file