| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
<html> |
| 6 |
<head> |
| 7 |
<title>Demo: dojox.data.CssClassStore</title> |
| 8 |
<style type="text/css"> |
| 9 |
@import "../../../dijit/themes/tundra/tundra.css"; |
| 10 |
@import "../../../dojo/resources/dojo.css"; |
| 11 |
@import "../../../dijit/tests/css/dijitTests.css"; |
| 12 |
@import "../../grid/resources/tundraGrid.css"; |
| 13 |
</style> |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: false, parseOnLoad: true"></script> |
| 20 |
<script> |
| 21 |
dojo.require("dijit.Tree"); |
| 22 |
dojo.require("dijit.tree.ForestStoreModel"); |
| 23 |
dojo.require("dijit.form.ComboBox"); |
| 24 |
dojo.require("dojox.data.CssRuleStore"); |
| 25 |
dojo.require("dojox.data.CssClassStore"); |
| 26 |
dojo.require("dojox.grid.DataGrid"); |
| 27 |
|
| 28 |
var layoutCss = [ |
| 29 |
[ |
| 30 |
{ field: "selector", name: "Selector", width: 20 }, |
| 31 |
{ field: "parentStyleSheetHref", name: "StyleSheet", width: 20 }, |
| 32 |
{ field: "cssText", name: "CSS", width: 'auto' } |
| 33 |
] |
| 34 |
]; |
| 35 |
|
| 36 |
function init() { |
| 37 |
var combo = dijit.byId("classCombo"); |
| 38 |
var grid = dijit.byId("cssGrid"); |
| 39 |
|
| 40 |
function requery() { |
| 41 |
var val = combo.getValue(); |
| 42 |
val = "." + val; |
| 43 |
var query = { |
| 44 |
selector: "*" + val + "*" |
| 45 |
} |
| 46 |
grid.filter(query,true); |
| 47 |
} |
| 48 |
dojo.connect(combo, "onChange", requery); |
| 49 |
} |
| 50 |
dojo.addOnLoad(init); |
| 51 |
|
| 52 |
</script> |
| 53 |
</head> |
| 54 |
|
| 55 |
<body class="tundra"> |
| 56 |
<h1> |
| 57 |
Demo: Demo of using the Css Stores to browse the loaded CSS classes and associated rules. |
| 58 |
</h1> |
| 59 |
<p>This demo demonstrates hooking up the Css*Stores to the various digit widgets to browse the Css loaded for the page.</p> |
| 60 |
<hr> |
| 61 |
|
| 62 |
<div dojoType="dojox.data.CssRuleStore" jsId="ruleStore"></div> |
| 63 |
<div dojoType="dojox.data.CssClassStore" jsId="classStore"></div> |
| 64 |
|
| 65 |
|
| 66 |
<div dojoType="dijit.tree.ForestStoreModel" |
| 67 |
jsId="classModel" |
| 68 |
store="classStore" |
| 69 |
query="{}" |
| 70 |
rootId="Loaded Classes" |
| 71 |
rootLabel="Loaded Classes" |
| 72 |
childrenAttrs="children"> |
| 73 |
</div> |
| 74 |
|
| 75 |
<h2>dojox.data.CssClassStore connected to ComboBox and querying on classSans:</h2> |
| 76 |
<div id="classCombo" dojoType="dijit.form.ComboBox" store="classStore" searchAttr="classSans"></div> |
| 77 |
|
| 78 |
<h2>dojox.data.CssRuleStore:</h2> |
| 79 |
<i>Displays the list of CSS rules filtered by the class selected in the ComboBox.</i> |
| 80 |
<div id="cssGrid" |
| 81 |
jsId="cssGrid" |
| 82 |
dojoType="dojox.grid.DataGrid" |
| 83 |
query="{}" |
| 84 |
rowsPerPage="20" |
| 85 |
store="ruleStore" |
| 86 |
structure="layoutCss" |
| 87 |
style="width: 100%; height: 400px;"> |
| 88 |
</div> |
| 89 |
|
| 90 |
<h2>dojox.data.CssClassStore connected to Tree:</h2> |
| 91 |
<span id="tree" dojoType="dijit.Tree" model="classModel"> </span> |
| 92 |
<hr> |
| 93 |
</body> |
| 94 |
</html> |