关于Ext中form移除textfield方法:hide(),setVisible(false),remove()

  问题:当使用hide()方法和setvisible(false)方法去除items的中间(见过很多例子移除的都是尾部表单)表单后,原form验证无效

  解决办法:使用remove(id)方法移除表单,可得到有效的form

  原因:未知,希望大家补充

  补充:下面是一个我遇到问题代码的简化版本,没有经过测试,大概意思是要是在form里想控制不显示表单,用remove()方法有效

  

复制代码 代码如下:

  new Ext.form.FormPanel({

  id : 'ReportForm',items : [{

  {id:"001"},

  {id:"002"},

  {id:"003"},

  {id:"004"},

  {id:"005"}

  }]

  });

  //Ext.getCmp("ReportForm").getForm().isValid()验证无效

  if(isTQ == 0){

  Ext.getCmp("003").hide();

  }

  //Ext.getCmp("ReportForm").getForm().isValid()验证无效

  if(isTQ == 0){

  Ext.getCmp("003").siteVisible(false);

  }

  //Ext.getCmp("ReportForm").getForm().isValid()验证有效

  if(isTQ == 0){

  Ext.getCmp("ReportForm").remove("003");

  }