examples/grid/viewpanel.js
authorChris <chris@roojs.com>
Mon, 21 Oct 2013 09:12:12 +0000 (17:12 +0800)
committerChris <chris@roojs.com>
Mon, 21 Oct 2013 09:12:12 +0000 (17:12 +0800)
examples/grid/viewpanel.js

index a0be85e..128062b 100644 (file)
@@ -234,5 +234,32 @@ Roo.onReady(function(){
     }]);
 
     // trigger the data store load
-    ds.load();
+//    ds.load();
+    
+    var gridFoot = grid.getView().getFooterPanel(true);
+
+    // add a paging toolbar to the grid's footer
+    var paging = new Roo.PagingToolbar(gridFoot, ds, {
+        pageSize: 25,
+        displayInfo: true,
+        displayMsg: 'Displaying topics {0} - {1} of {2}',
+        emptyMsg: "No topics to display"
+    });
+    // add the detailed view button
+    paging.add('-', {
+        pressed: true,
+        enableToggle:true,
+        text: 'Detailed View',
+        cls: 'x-btn-text-icon details',
+        toggleHandler: toggleDetails
+    });
+
+    // trigger the data store load
+    ds.load({params:{start:0, limit:25}});
+
+    function toggleDetails(btn, pressed){
+        cm.getColumnById('topic').renderer = pressed ? renderTopic : renderTopicPlain;
+        cm.getColumnById('last').renderer = pressed ? renderLast : renderLastPlain;
+        grid.getView().refresh();
+    }
 });
\ No newline at end of file