简体   繁体   English

如何完全删除文本框中的值存储?

[英]How to completely remove the value store in the text box?

function NewRecord() {
   var id = Ext.getCmp('input_id').clear();
   var code = Ext.getCmp('input_code').clear();
   var description = Ext.getCmp('input_description').clear();
}

I need to remove the value from text box, it works but code behind still gets the id. 我需要从文本框中删除该值,它可以工作,但后面的代码仍会获取ID。 The code above i do it in js. 上面的代码我在js中完成。

Try this. 尝试这个。

function NewRecord() {
       var id = Ext.getCmp('input_id').remove();
       var code = Ext.getCmp('input_code').remove()
       var description = Ext.getCmp('input_description').remove();
    }

Instead of using Id, you can set a value for the reference property. 您可以为引用属性设置一个值,而不是使用Id。 In view controller, call: this.lookupReference("refNameToTextBox") to get reference to the textbox; 在视图控制器中,调用: this.lookupReference(“ refNameToTextBox”)以获取对文本框的引用;

function NewRecord() {
   var id = Ext.getCmp('input_id').setValue("");
   var code = Ext.getCmp('input_code').setValue("");
   var description = Ext.getCmp('input_description').setValue("");
}

you can clear the text value by setValue("") . 您可以通过setValue("")清除文本值。 please try this. 请尝试这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM