0

以下に示すように、json にある _type など、node_id とともにカスタム クエリ文字列パラメーターを送信したい jQuery を使用しています。

[{
    "id":"2",    
    "label":"Title for folder",    
    "branch":[],    
    "inode":true,    
    "open":false,    
    "icon":"folder",    
    "_type":"library"
}]

ajaxhook以下に示すように試しています

ajaxHook: function (item, settings) {
    // the default implementation changes the URL by adding the item ID at the end    
    alert(this.itemData._type);    
    settings.url += (item ? this.getId(item) : '');    
}

_typeこのメソッドを使用してカスタム プロパティを取得できません。

4

2 に答える 2

0

以下は、これを行う正しい方法です。

  ajaxHook: function (item, settings) {
                    // the default implementation changes the URL by adding the item ID at the end
                    if (item != null) {
                        var ItemData = this.itemData(item);
                        settings.url += (item ? this.getId(item) : '') + '&type=' + ItemData._type;
                    }
                },
于 2015-10-21T07:21:13.060 に答える
0

this.itemData は配列であるため、ループするか、次のようにします。

alert(this.itemData[0]._type);
于 2015-10-20T14:40:40.763 に答える