動的検索のためにNestedSortingを使用してdojo(1.8)EnhancedGridを使用しています。すべての検索は列の数が異なるため、setStoreを使用する前に最後の並べ替えをリセットします。私がグリッドをソートするためにクリックしたとき、dojoは新しいリクエストの最後のソートを現時点で追加します。私はsetNewDataToGrid()を使うたびに何もせずに開始したい。私はそれを達成する方法はありますか?dojo EnhancedGrid reset nestedSort
私のテストHTML:
<div id="testGrid"></div>
<span onClick="setNewDataToGrid();">test</span>
私のグリッドは、次のとおりです。
require([
"dojox/grid/EnhancedGrid",
"dojox/data/JsonRestStore",
"dojox/grid/enhanced/plugins/NestedSorting",
"dojox/grid/enhanced/plugins/Exporter",
"dojo/domReady!",
"dojox/grid/cells/dijit"
], function(DataGrid, JsonRestStore) {
var store = new JsonRestStore({target:"/basis/contact/"});
var grid = new DataGrid({
style: "height: 400px;",
store: store,
query: "",
plugins: {"nestedSorting": true},
structure: [
{
defaultCell: { editable: false },
cells: [
{ name: "ID", field: "id", width: "50px", },
{ name: "Name", field: "p_familienname", width: "200px"},
]
}
],
selectionMode: "single"
}, "testGrid");
grid.startup();
});
マイリセット機能は次のとおりです。
function setNewDataToGrid() {
require(["dojox/data/JsonRestStore"], function (JsonRestStore) {
var grid = dijitRegistry.byId("testGrid");
var dataStore = new JsonRestStore({target: "/basis/member/"});
// here I'm adding the new layout with other columns
[...]
grid.setStructure(newColumns);
//insert reset sort here!
var query = "somethingnew..."
gid.setStore(dataStore, query);
});
}