0

dojoグリッドウィジェットでデータをフィルタリングしようとしていますが、うまくいきません。

以下に、グリッドを正常に作成するために使用するjavascriptを投稿しましたが、すべてのデータが表示されています。IsBaseLevelを引用符で囲み、falseを引用符で囲んでみましたが、解決策が見つからないようです。いつものように、どんな助けや提案も大歓迎です。さらに詳しい情報が必要な場合は、お知らせください。

Javascript(dojo.readyからa()への関数呼び出しを除く):

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
    }
  }
]
4

1 に答える 1

0

問題が見つかりました。クライアント(ブラウザー)でデータを受信すると、フィルターがデータに適用されることを期待していました。ただし、ネットワークを調べたところ、サービスが?IsBaseLevel=falseクエリ文字列で呼び出されていることがわかりました。したがって、Webサービスは、データに適用するフラグを適切にサポートする必要があります。

于 2012-02-11T19:29:40.890 に答える