开发者

Can you use a function argument directly in a namespace?

开发者 https://www.devze.com 2023-04-03 09:49 出处:网络
I have the following function: prevPage: function (store){ myapp.stores.store.proxy.extraParams = { sendpage: myapp.stores.store.data.items[0].data.currentPage -1 };

I have the following function:

prevPage: function (store){

    myapp.stores.store.proxy.extraParams = { sendpage: myapp.stores.store.data.items[0].data.currentPage -1 };
    },

Which basically modifies the extraParams namespace according to whatever 'store' is entered as an argument in the function, but it doesn't work. I think I am using 'store' wrong in the function definition.

To rephrase, if I define the function as:

  prevPage: function (){

    myapp.stores.examplestore.proxy.extraParams = { sendpage:    myapp.stores.store.data.items[0].data.currentPage -1 };
    },

It works correctly for the examplestore namespace.

开发者_StackOverflow中文版How do I do it so I can have that namespace as a variabl argument in the function?


You have to write it this way myapp.stores[store].proxy.extraParams where store is a string.

0

精彩评论

暂无评论...
验证码 换一张
取 消