If you can use the EnhancedGrid, it supports a Filter function that supports
complex queries.
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/how-to-use-or-conditional-in-grid-setQuery-tp3712349p3712365.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojotoolkit: http://dojotoolkit.org
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api
Tutorials: http://dojotoolkit.org/documentation
Dojo-i...@mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
See http://dojotoolkit.org/reference-guide/dojox/data/AndOrReadStore.html
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/how-to-use-or-conditional-in-grid-setQuery-tp3712349p3712394.html
gridID2.store.fetch({query: {complexQuery:"categoria:3 OR categoria:4"}});
gridID2.setQuery({query: {complexQuery:"categoria:3 OR categoria:4"}});
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/how-to-use-or-conditional-in-grid-setQuery-tp3712349p3712443.html
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/how-to-use-or-conditional-in-grid-setQuery-tp3712349p3712472.html
dojoType="dojox.grid.DataGrid"
id="tipo_inmueble"
store="tipo_inmueble"
clientSort="true"
escapeHTMLInData="false"
<thead>
<tr>
<th name='Predio' field="nombre" width="100%" nowrap ></th>
</tr></thead>
var valuex = "";
for(i=0;i<(items.length);i++){
if(i<(items.length-1)){
}else{
}
}
console.log(valuex); // categoria:2 OR categoria:3
gridID2.setQuery({valuex});
Note: some of initial html and trailing html tags code/tags are omitted
below so that the forum software will display the code formatted reasonably.
dojo.require("dojox.grid.DataGrid");
dojo.require("dojox.data.AndOrWriteStore");
dojo.ready(function(){
/*set up data store*/
var data = {
identifier: 'id',
items: []
};
var data_list = [
{ col1: "normal", col2: false, col3: 'But are not followed by two
hexadecimal', col4: 29.91},
{ col1: "important", col2: false, col3: 'Because a % sign always
indicates', col4: 9.33},
{ col1: "important", col2: false, col3: 'Signs can be selectively',
col4: 19.34}
];
var rows = 60;
for(var i=0, l=data_list.length; i<rows; i++){
data.items.push(dojo.mixin({ id: i+1 }, data_list[i%l]));
}
var store = new dojox.data.AndOrWriteStore({data: data});
/*set up layout*/
var layout = [[
{'name': 'Column 1', 'field': 'id', 'width': '100px'},
{'name': 'Column 2', 'field': 'col2', 'width': '100px'},
{'name': 'Column 3', 'field': 'col3', 'width': '200px'},
{'name': 'Column 4', 'field': 'col4', 'width': '150px'}
]];
/*create a new grid:*/
var grid = new dojox.grid.DataGrid({
id: 'grid',
store: store,
structure: layout,
rowSelector: '20px'},
document.createElement('div'));
/*append the new grid to the div*/
dojo.byId("gridDiv").appendChild(grid.domNode);
/*Call startup() to render the grid*/
grid.startup();
});
function filterItOne() {
dijit.byId('grid').setQuery({complexQuery:"id:3 OR id:2"});
}
function filterItTwo() {
dijit.byId('grid').setQuery({complexQuery:"id:3 OR
col4:'9.33'"});
}
function resetFilter() {
dijit.byId('grid').setQuery({id:"*"});
}
</script>
</head>
<body class="tundra">
<button onclick="filterItOne();">Filter on: "id:3 OR id:2"</button><button
onclick="filterItTwo();">Filter on: "id:3 OR col4:'9.33'"</button><button
onclick="resetFilter();">Reset Filter</button>
<div id="gridDiv"></div>
</body>
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/how-to-use-or-conditional-in-grid-setQuery-tp3712349p3713344.html