| 1 | <html> |
|---|
| 2 | <head tal:define="dojoBaseURL container/dojoBaseURL10;"> |
|---|
| 3 | <title tal:content="template/title">The title</title> |
|---|
| 4 | <link tal:replace="structure python:context.includeDojo10(context, debug_mode=False, parseWidgets=True)" /> |
|---|
| 5 | |
|---|
| 6 | <!-- CSS Styles --> |
|---|
| 7 | |
|---|
| 8 | <link rel="stylesheet" type="text/css" tal:attributes="href string:${dojoBaseURL}/dojox/grid/z_grid/Grid.css" /> |
|---|
| 9 | <link rel="stylesheet" type="text/css" tal:attributes="href string:${dojoBaseURL}/dojox/grid/z_grid/tundraGrid.css" /> |
|---|
| 10 | <link rel="stylesheet" type="text/css" tal:attributes="href string:${dojoBaseURL}/dojo/resources/dojo.css" /> |
|---|
| 11 | <link rel="stylesheet" type="text/css" tal:attributes="href string:${dojoBaseURL}/dijit/themes/tundra/tundra.css" /> |
|---|
| 12 | |
|---|
| 13 | <!-- Javascript --> |
|---|
| 14 | |
|---|
| 15 | <script type="text/javascript"> |
|---|
| 16 | dojo.require("dojo.data.ItemFileReadStore"); |
|---|
| 17 | dojo.require("dojox.data.QueryReadStore"); |
|---|
| 18 | dojo.require("dojox.grid.Grid"); |
|---|
| 19 | dojo.require("dojox.grid.z_data.model"); |
|---|
| 20 | dojo.require("dijit.dijit"); |
|---|
| 21 | dojo.require("dojo.parser"); // scan page for widgets and instantiate them |
|---|
| 22 | </script> |
|---|
| 23 | |
|---|
| 24 | <script type="text/javascript"> |
|---|
| 25 | |
|---|
| 26 | // a grid view is a group of columns. |
|---|
| 27 | var view1 = { |
|---|
| 28 | cells: |
|---|
| 29 | [ |
|---|
| 30 | [ |
|---|
| 31 | {name: 'testCell_1', field: "testCell_1"}, |
|---|
| 32 | {name: 'testCell_2', width: "25em", field: "testCell_2"} |
|---|
| 33 | ], |
|---|
| 34 | ] |
|---|
| 35 | }; |
|---|
| 36 | |
|---|
| 37 | // a grid layout is an array of views. |
|---|
| 38 | var layout = [ view1 ]; |
|---|
| 39 | |
|---|
| 40 | // get new Data for the Grid and show it. |
|---|
| 41 | function gridDataUpdate(){ |
|---|
| 42 | var model = dijit.byId("grid").model |
|---|
| 43 | model.query = {testAttribute:dojo.byId("queryValue").value}; |
|---|
| 44 | model.refresh(); // Updates model data with store data. |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | </script> |
|---|
| 48 | |
|---|
| 49 | </head> |
|---|
| 50 | <body> |
|---|
| 51 | <div class="heading">QueryReadStoreTest</div> |
|---|
| 52 | <br /> |
|---|
| 53 | <div dojoType="dojo.data.ItemFileReadStore" id="IFR_Store" jsId="IFR_Store" url="QRStoreTestScript"></div> |
|---|
| 54 | <div dojoType="dojox.data.QueryReadStore" id="QR_Store" jsId="QR_Store" url="QRStoreTestScript"></div> |
|---|
| 55 | <div dojoType="dojox.grid.data.DojoData" id="model" jsId="model" rowsPerPage="20" store="QR_Store" query="{}"></div> |
|---|
| 56 | <div dojoType="dojox.Grid" id="grid" model="model" structure="layout" autowidth="true"></div> |
|---|
| 57 | Query value: |
|---|
| 58 | <input name="queryValue" type="text" size="2" maxlength="2" value="1"> |
|---|
| 59 | <br /> |
|---|
| 60 | <input type="button" value="send Query" onclick="gridDataUpdate()"/> |
|---|
| 61 | </body> |
|---|
| 62 | </html> |
|---|