Я пытаюсь отфильтровать данные в виджете сетки додзё, но мне не повезло.
Ниже я разместил javascript, который я использую для успешного создания сетки, однако все данные отображаются. Я попытался заключить в кавычки IsBaseLevel и ложь в кавычках, я не могу найти решение. Как всегда, любая помощь или предложения приветствуются. Если вам нужна дополнительная информация, пожалуйста, дайте мне знать.
Javascript (без вызова функции из dojo.ready в ()):
var grid;
function a() {
var store = new dojox.data.JsonRestStore({ target: "/Services/Security/SecurityArea/", idAttribute: "id", syncMode: true });
var gridLayout = [
{ name: "Id", field: "Id" },
{ name: "Name", field: "Name" },
{ name: "Parent Id", field: "Parent", formatter: formatParent },
{ name: "Description", field: "Description"},
{ name: "IsBaseLevel", field: "IsBaseLevel"}];
grid = new dojox.grid.DataGrid({
store: store,
structure: gridLayout
}, document.createElement("div"));
grid.placeAt(dojo.body(), "last");
grid.startup();
grid.filter({ IsBaseLevel: false });
}
function formatParent(data) {
if (typeof data != "undefined" && data != null) {
var menu = new dijit.DropDownMenu({ style: "display: none;" });
menu.addChild(new dijit.MenuItem({
label: "Test 1",
iconClass: "dijitEditorIcon dijitEditorIconSave",
onClick: function () { alert('save'); }
}));
menu.addChild(new dijit.MenuItem({
label: "Test 1",
iconClass: "dijitEditorIcon dijitEditorIconCut",
onClick: function () { alert('cut'); }
}));
var button = new dijit.form.DropDownButton({
label: "hello!",
name: "programmatic2",
dropDown: menu
});
return button;
}
else return null;
}
Данные JSON
[
{
"UtcCreated": "\/Date(1327877500038-0600)\/",
"UtcModified": "\/Date(1327877500038-0600)\/",
"UtcDisabled": null,
"CreatedBy": null,
"ModifiedBy": null,
"DisabledBy": null,
"Id": 4,
"Name": "/Home.aspx",
"Description": "The primary user home",
"IsBaseLevel": true,
"Parent": null
},
{
"UtcCreated": "\/Date(1327877500038-0600)\/",
"UtcModified": "\/Date(1327877500038-0600)\/",
"UtcDisabled": null,
"CreatedBy": null,
"ModifiedBy": null,
"DisabledBy": null,
"Id": 5,
"Name": "Security.GetSecurityAreas",
"Description": "Provides a list of security areas",
"IsBaseLevel": true,
"Parent": null
},
{
"UtcCreated": "\/Date(1327877500038-0600)\/",
"UtcModified": "\/Date(1327877500038-0600)\/",
"UtcDisabled": null,
"CreatedBy": null,
"ModifiedBy": null,
"DisabledBy": null,
"Id": 6,
"Name": "UI.GetDomObjects",
"Description": "Gets all the DOM objects for the client",
"IsBaseLevel": true,
"Parent": null
},
{
"UtcCreated": "\/Date(1327877500038-0600)\/",
"UtcModified": "\/Date(1327877500038-0600)\/",
"UtcDisabled": null,
"CreatedBy": null,
"ModifiedBy": null,
"DisabledBy": null,
"Id": 3,
"Name": "Test Security Area",
"Description": null,
"IsBaseLevel": false,
"Parent": {
"UtcCreated": "\/Date(1327877500038-0600)\/",
"UtcModified": "\/Date(1327877500038-0600)\/",
"UtcDisabled": null,
"CreatedBy": null,
"ModifiedBy": null,
"DisabledBy": null,
"Id": 4,
"Name": "/Home.aspx",
"Description": "The primary user home",
"IsBaseLevel": true,
"Parent": null
}
}
]