paging.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*!
  2. * Ext JS Library 3.0.0
  3. * Copyright(c) 2006-2009 Ext JS, LLC
  4. * licensing@extjs.com
  5. * http://www.extjs.com/license
  6. */
  7. Ext.onReady(function(){
  8. // create the Data Store
  9. var store = new Ext.data.JsonStore({
  10. root: 'data',
  11. totalProperty: 'totalCount',
  12. idProperty: 'threadid',
  13. remoteSort: true,
  14. fields: [
  15. 'task','workflow' ],
  16. // load using script tags for cross domain, if the data in on the same domain as
  17. // this page, an HttpProxy would be better
  18. proxy: new Ext.data.HttpProxy({
  19. url: '/ynet/PagingTest.do'
  20. })
  21. });
  22. // pluggable renders
  23. function renderTopic(value, p, record){
  24. return ("aaa")
  25. }
  26. var grid = new Ext.grid.GridPanel({
  27. width:700,
  28. height:500,
  29. title:'ExtJS.com - Browse Forums',
  30. store: store,
  31. trackMouseOver:false,
  32. disableSelection:true,
  33. loadMask: true,
  34. // grid columns
  35. columns:[{
  36. id: 'topic', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
  37. header: "task",
  38. dataIndex: 'task',
  39. width: 420,
  40. renderer: renderTopic,
  41. sortable: true
  42. },{
  43. header: "workflow",
  44. dataIndex: 'workflow',
  45. width: 100,
  46. sortable: true
  47. }],
  48. // paging bar on the bottom
  49. bbar: new Ext.PagingToolbar({
  50. pageSize: 25,
  51. store: store,
  52. displayInfo: true,
  53. displayMsg: 'Displaying topics {0} - {1} of {2}',
  54. emptyMsg: "ûÓмǼ"
  55. })
  56. });
  57. // render it
  58. grid.render('grid');
  59. // trigger the data store load
  60. store.load({params:{start:0, limit:25}});
  61. });