天天看點

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

一個很小的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
A small tip to explore how to call a method of a control

繼續閱讀