A small tip to explore how to call a method of a control

Created by Jerry Wang, last modified on Mar 20, 2015

一个很小的tip:比如我想把一个table里的每个column 设置成宽度自适应的,需要知道应该call哪个方法来实现。

[外链图片转存失败(img-zsZYaNSR-1568514504160)(https://user-images.githubusercontent.com/5669954/27319091-09e05484-5590-11e7-9566-d5418a44d2b9.png)]
一种办法是查help 文档,另一种办法是在debugger里研究:

根据经验这种API一般naming convention都是set:
A small tip to explore how to call a method of a control

根据经验定位到应该call setAutoResizable这个方法。下一个问题就是这个方法到底应该传什么参数进去。

直接在debugger里执行方法getMetadata, 展开返回的结果:
A small tip to explore how to call a method of a control
这里说明这个set方法应该传一个boolean进去:
A small tip to explore how to call a method of a control要获取更多Jerry的原创文章,请关注公众号"汪子熙":
A small tip to explore how to call a method of a control

上一篇:git push时出现Updates were rejected because the tip of your current branch is behind的解决办法


下一篇:1347 旋转字符串