Guest User

Untitled

a guest
Apr 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xp:view xmlns:xp="http://www.ibm.com/xsp/core" dojoParseOnLoad="true"
  3. dojoTheme="true">
  4.  
  5. <xp:this.resources>
  6. <xp:dojoModule name="dojox.grid.EnhancedGrid"></xp:dojoModule>
  7. <xp:dojoModule name="dojox.grid.enhanced.plugins.DnD"></xp:dojoModule>
  8. <xp:dojoModule
  9. name="dojox.grid.enhanced.plugins.NestedSorting">
  10. </xp:dojoModule>
  11. <xp:dojoModule
  12. name="dojox.grid.enhanced.plugins.IndirectSelection">
  13. </xp:dojoModule>
  14. <xp:dojoModule name="dojox.grid.enhanced.plugins.Filter"></xp:dojoModule>
  15. <xp:dojoModule name="dojo.data.ItemFileWriteStore"></xp:dojoModule>
  16.  
  17. <xp:styleSheet
  18. href="/.ibmxspres/dojoroot/dijit/themes/tundra/tundra.css">
  19. </xp:styleSheet>
  20. <xp:styleSheet
  21. href="/.ibmxspres/dojoroot/dojox/grid/resources/Grid.css">
  22. </xp:styleSheet>
  23. <xp:styleSheet
  24. href="/.ibmxspres/dojoroot/dojox/grid/resources/tundraGrid.css">
  25. </xp:styleSheet>
  26. <xp:styleSheet
  27. href="/.ibmxspres/dojoroot/dojox/grid/enhanced/esources/EnhancedGrid.css">
  28. </xp:styleSheet>
  29. <xp:styleSheet
  30. href="/.ibmxspres/dojoroot/dojox/grid/enhanced/esources/tundraEnhancedGrid.css">
  31. </xp:styleSheet>
  32. </xp:this.resources>
  33.  
  34. <xp:br></xp:br>
  35.  
  36.  
  37. <xp:div id="gridDiv"></xp:div>
  38.  
  39. <xp:eventHandler event="onClientLoad" submit="false">
  40. <xp:this.script>
  41. <xp:executeClientScript>
  42. <xp:this.script><![CDATA[dojo.addOnLoad(function(){
  43.  
  44. //setup the grid layout, format = {'name': 'columntitle', 'field': 'fieldname'}
  45.  
  46. var layout = [{
  47. defaultCell: {editable: false, type: dojox.grid.cells._Widget},
  48. rows:[
  49. {'field': "qtno", 'name': "Quote No.", 'width': '40px'},
  50. {'field': "cusno", 'name': "Cust #", 'width': '60px'},
  51. {'field': "cusnm", 'name': "Customer", 'width': '150px'},
  52. {'field': "qtamt", 'name': "Quote Amt", 'width': '40px', 'datatype':'number'},
  53. ]
  54. }]
  55.  
  56. //setup data store
  57. var data = {
  58. identifier: 'id',
  59. items: []
  60. };
  61.  
  62. //setup data array of strings, format = {fieldname: "strvalue", fieldname: numvalue}
  63. var data_list = [
  64. { qtno: "Q01234", cusno: "4419", cusnm: "ABC Corporation", qtamt: 29.91},
  65. { qtno: "Q42198", cusno: "3308", cusnm: "Acme Company", qtamt: 9.33},
  66. { qtno: "Q11095", cusno: "7041", cusnm: "XYZ Industries", qtamt: 19.34}
  67. ];
  68.  
  69. //default the rows
  70. var rows = data_list.length;
  71.  
  72. //populate the store with the data array of strings
  73. for(var i=0, l=data_list.length; i<rows; i++){
  74. data.items.push(dojo.mixin({ id: i+1 }, data_list[i%l]));
  75. }
  76. var store = new dojo.data.ItemFileWriteStore({data: data});
  77.  
  78. //define the grid
  79. var grid = new dojox.grid.EnhancedGrid({
  80. id: 'grid',
  81. query: {},
  82. store: store,
  83. structure: layout,
  84. rowSelector: '20px',
  85. autoHeight: 125,
  86. plugins:{nestedSorting:true, dnd:true, filter:true}
  87. }, '#{id:gridDiv}');
  88.  
  89. //create it
  90. grid.startup();
  91.  
  92. })
  93.  
  94.  
  95. ]]></xp:this.script>
  96. </xp:executeClientScript>
  97. </xp:this.script></xp:eventHandler></xp:view>
Add Comment
Please, Sign In to add comment