开发者

How to update view with no model from controller in Sencha Touch?

开发者 https://www.devze.com 2023-03-02 18:12 出处:网络
For some views I use just a controller (no model). How do I update the view after I\'ve made some changes to it\'s components. Say, I can use the setValue method on a TextField to change the 开发者_运

For some views I use just a controller (no model). How do I update the view after I've made some changes to it's components. Say, I can use the setValue method on a TextField to change the 开发者_运维技巧value of the field, but there is no equivalent setLabel method. Do I have to call some method to update the view after changing the label property of a TextField component?


You could just alter the HTML of the label element.

var tf = <some text field>
tf.labelEl.setHTML('<span>NEW LABEL</span>');

There doesn't seem to be an easy way to set the label from the API they expose. But if they did, I imagine that it would look like this:

function setLabel(text){
  this.labelEl.setHTML('<span>' + text + '</span>');
}
0

精彩评论

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