4 * Copyright(c) 2006-2007, Ext JS, LLC.
6 * Originally Released Under LGPL - original licence link has changed is not relivant.
9 * <script type="text/javascript">
12 Roo.BLANK_IMAGE_URL = "../../images/default/s.gif";
16 Roo.onReady(function(){
18 function formatBoolean(value){
19 return value ? 'Yes' : 'No';
22 function formatDate(value){
23 return value ? value.dateFormat('M d, Y') : '';
26 // var fm = Roo.form, Ed = Roo.ViewPanel;
28 // the column model has information about grid columns
29 // dataIndex maps the column to the specific data field in
30 // the data store (created below)
31 var cm = new Roo.grid.ColumnModel([{
32 header: "Common Name",
36 editor: new Ed(new fm.TextField({
41 // by default columns are sortable
42 cm.defaultSortable = true;
44 // this could be inline, but we want to define the Plant record
45 // type so we can add records dynamically
47 // create the Data Store
48 var ds = new Roo.data.Store({
50 proxy: new Roo.data.HttpProxy({url: 'get-images.php'}),
53 // the return will be XML, so lets set up a reader
54 reader: new Roo.data.JsonReader({
56 totalProperty: 'totalCount',
59 {name: 'name', type: 'string'},
60 {name: 'size', type: 'string'},
61 {name: 'lastmod', type: 'string'},
62 {name: 'url', type: 'string'}
66 // create the editor grid
67 grid = new Roo.ViewPanel('editor-grid', {
78 var layout = Roo.BorderLayout.create({
80 margins:{left:3,top:3,right:3,bottom:3},
81 panels: [new Roo.panel.Grid(grid)]
90 var gridHead = grid.getView().getHeaderPanel(true);
91 var tb = new Roo.Toolbar(gridHead, [{
98 // trigger the data store load
101 var gridFoot = grid.getView().getFooterPanel(true);
103 // add a paging toolbar to the grid's footer
104 var paging = new Roo.PagingToolbar(gridFoot, ds, {
107 displayMsg: 'Displaying topics {0} - {1} of {2}',
108 emptyMsg: "No topics to display"
110 // add the detailed view button
114 text: 'Detailed View',
115 cls: 'x-btn-text-icon details',
116 toggleHandler: toggleDetails
119 // trigger the data store load
120 ds.load({params:{start:0, limit:25}});
122 function toggleDetails(btn, pressed){
123 cm.getColumnById('topic').renderer = pressed ? renderTopic : renderTopicPlain;
124 cm.getColumnById('last').renderer = pressed ? renderLast : renderLastPlain;
125 grid.getView().refresh();