0
dojo grid 위젯에서 데이터를 필터링하려고하는데 운이 없다.Dojo 격자의 데이터 필터링 dojox.grid.DataGrid
아래 그림은 그리드를 성공적으로 만들기 위해 사용하는 자바 스크립트입니다. 그러나 모든 데이터가 표시됩니다. 나는 IsBaseLevel을 둘러싼 것을 따옴표로 묶어 쓰려고했지만, 그 치료법을 찾을 수없는 것 같습니다. 언제나처럼, 어떤 도움이나 제안도 환영합니다. 더 자세한 정보가 필요하면 알려주십시오.
자바 스크립트 (마이너스()에 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
}
}
]
내 2 일간의 일정은 다음과 같습니다. x – Lucas