前言
好久沒寫博客了,一直在整改。前幾天還有個大佬在羣裏說不想寫博客了,沒有回報並且很容易被別人白嫖。確實,自己寫的還沒別人轉載的排名靠前、訪問量多。其實,一個平臺的好壞取決於原創作者的質量,比如十幾年前的天涯論壇。。。
背景
最近三個月一直在做arcgis api for js,目前有幾個Popup上需要加按鈕。
環境
arcgis api for js 4.18
問題
現在有4個actions,但是第四個會被自動隱藏到右邊,如圖:
但我現在想讓這四個並排的。
嘗試過程
這個問題比較難找,開始沒理解透pop和poptemplate的關係
查了一下,
解決方案
這個在4.15版本後,可以通過maxInlineActions
屬性設置在Popup
中顯示的最大actions數量。
4.15版本以前(見網址②),應該可以設置View.popup.actionsmenuenabled = false來實現,我在最新文檔(目前是4.19)裏面搜關鍵詞,會直接定位到maxInlineActions:
可以看到,默認顯示actions的數量確實是3,即使位置足夠,也是隻顯示三個。如果超過3個,比如4個,可以在sceneview 裏pop設置
maxInlineActions的數量爲4。
1 popup: { 2 // autoCloseEnabled: true, 3 // collapseEnabled: true, 4 // collapsed: false, 5 // dockEnabled: true, 6 maxInlineActions:4, 7 // dockOptions: { 8 // position: "top-right", 9 // breakpoint: false 10 // }, 11 }
參考網址
② SAPI 4.10: Popup Actions now under "..." buttonJSAPI 4.10
③ LayerList widget with actions