Sencha Touch视图中的隐藏值

时间:2022-08-24 11:41:57

I am working in a Sencha Touch app, from a Json file I am getting the customization of the cart icon with the next api.

我在Sencha Touch应用程序中工作,从Json文件我正在使用下一个api定制购物车图标。

{
  "user":
    {
      "orderEnabled": true
    }
}

Controller calls to the backend correctly but in the view I have a doubt with the hidden parameter in the component, How to set correctly the value of hidden sent from the backend?

控制器正确调用后端,但在视图中我对组件中的隐藏参数有疑问,如何正确设置从后端发送的隐藏值?

For example:

          {
                title: 'Cart,
                iconCls: 'shoppingcart',
                itemId: 'cart',
                hidden: ' What should it be the value? backend send me the value'
            },

Thank you in advance!!

先感谢您!!

1 个解决方案

#1


To hide the 'cart' component:

隐藏'购物车'组件:

    {
        title: 'Cart,
        iconCls: 'shoppingcart',
        itemId: 'cart',
        hidden: true
   },

To show the 'cart' component:

要显示'购物车'组件:

    {
        title: 'Cart,
        iconCls: 'shoppingcart',
        itemId: 'cart',
        hidden: false
    },

If you are showing/hiding the component based on the value of a variable, then from within a controller you can retrieve the component using a ComponentQuery and call .setHidden(true) or .setHidden(false) on it (assuming 'cart' supports the hidden config property).

如果您根据变量的值显示/隐藏组件,则可以从控制器中使用ComponentQuery检索组件并在其上调用.setHidden(true)或.setHidden(false)(假设'cart'支持隐藏的配置属性)。

#1


To hide the 'cart' component:

隐藏'购物车'组件:

    {
        title: 'Cart,
        iconCls: 'shoppingcart',
        itemId: 'cart',
        hidden: true
   },

To show the 'cart' component:

要显示'购物车'组件:

    {
        title: 'Cart,
        iconCls: 'shoppingcart',
        itemId: 'cart',
        hidden: false
    },

If you are showing/hiding the component based on the value of a variable, then from within a controller you can retrieve the component using a ComponentQuery and call .setHidden(true) or .setHidden(false) on it (assuming 'cart' supports the hidden config property).

如果您根据变量的值显示/隐藏组件,则可以从控制器中使用ComponentQuery检索组件并在其上调用.setHidden(true)或.setHidden(false)(假设'cart'支持隐藏的配置属性)。