Sencha touch 在detailCard中隐藏搜索字段

Sencha touch 在detailCard中隐藏搜索字段,sencha-touch,extjs,sencha-touch-2,Sencha Touch,Extjs,Sencha Touch 2,我对列表的元素进行了搜索,但问题是搜索字段显示在列表项的详细卡片上。我需要在详细卡片中隐藏搜索字段。 我试图将其隐藏在控制器中: showDetail: function(list, record) { this.getMain().push({ xtype: 'recipedetail', title: record.fullName(), data: record.data }), this.getMain().get

我对列表的元素进行了搜索,但问题是搜索字段显示在列表项的详细卡片上。我需要在详细卡片中隐藏搜索字段。 我试图将其隐藏在控制器中:

showDetail: function(list, record) {
    this.getMain().push({
        xtype: 'recipedetail',
        title: record.fullName(),
        data: record.data
    }),
     this.getMain().getNavigationBar.hide({   
    xtype: 'searchfield',
    itemId:'contact_search'     

      })
        }
并试图将其隐藏在详细信息卡中:

config: {
   ...,
   items: [{
    xtype: 'searchfield',
    itemId:'contact_search',
    hidden: true
    }] 
}
但搜索字段仍然显示。代码错误还是我的想法方向错误?
隐藏搜索栏的代码中有很多错误

  • 您可以在
    getNavigationbar
    函数中输入()的值
  • “隐藏”函数将动画或布尔值作为参数,而不是要隐藏的组件
  • 你忘了分号
现在,要隐藏searchfield,请首先在控制器的配置中添加对此searchfield的引用:

config: {
    refs: {
        main: 'mainpanel',
        searchfield: 'mainpanel searchfield'
    },
    ...
现在,您可以使用
this.getSearchfield()
访问
searchfield
组件,因此您只需执行以下操作:

this.getSearchfield().hide();
希望这对我有帮助(我是新来森查的,你的回答对我帮助很大,非常感谢!