在Dojo dijit.form.FilteringSelect小部件上執行以下代碼時,我遇到了IE8問題。執行下面的代碼時,我沒有收到錯誤消息,但它沒有設置該值。它適用於Chrome和Firefox,但當然不是IE8。任何想法如何解決這個問題?Dojo dijit.form.FilteringSelect未在IE8中設置值
dijit.byId(「tracking_system_select_id」).set(「value」,7);
在Dojo dijit.form.FilteringSelect小部件上執行以下代碼時,我遇到了IE8問題。執行下面的代碼時,我沒有收到錯誤消息,但它沒有設置該值。它適用於Chrome和Firefox,但當然不是IE8。任何想法如何解決這個問題?Dojo dijit.form.FilteringSelect未在IE8中設置值
dijit.byId(「tracking_system_select_id」).set(「value」,7);
我知道道場選擇不帶數值的效果很好,
爲了達到最佳效果,只能使用的dijit /表格/與商店,其項目的身份是字符串選擇。
http://dojotoolkit.org/documentation/tutorials/1.8/selects_using_stores/
我不知道是否有是FilteringSelect相同的限制,但可能是一些嘗試。
好了,現在我打電話以下設置的值,我改變了它的7至「7」:
dijit.byId("tracking_system_select_id").set("value", "7");
,然後我調用下面的測試價值是什麼:
console.log("Main.trackingSystemId: " + dijit.byId("tracking_system_select_id").get("value"));
console.log("Main.trackingSystem: " + dijit.byId('tracking_system_select_id').attr('displayedValue'));
var test = dijit.byId('tracking_system_select_id').get('value');
if (typeof test === 'string'){
console.log('typeof string');
} else if (typeof(test === 'number')){
console.log('typeof number');
} else {
console.log('typeof unknown');
}
,並獲得日誌條目:
LOG:Main.trackingSystemId:
LOG:Main.trackingSystem:
日誌:typeof字符串
我還添加了.startup()來創建FilteringSelect。從數字標識符更改爲字符串標識符沒有區別。數據存儲中的標識符值也是字符串,所以我沒有字符串數字問題。
好的,這是我發現的。我嘗試創建一個dijit.form.FilteringSelect框並在創建時設置其默認值,它可以在Firefox和Chrome中使用,但不會再在IE8或IE9中使用。我要放棄並接受它在IE中不起作用。
如果Dojo解決了這個問題,會不錯。
Jeremiah,謝謝你的建議。我嘗試使用字符串值作爲身份,也沒有工作。 – Karl
通過「沒有工作」,你的意思是沒有visibile變化? get(「value」)返回什麼不同?另外,你是否在窗口小部件上調用了startup()(只有在你以編程方式創建它時才重要)? –
沒有明顯的變化,我還在widget上添加了startup()。以下是我發佈的帖子,其中有一些代碼顯示了我爲測試和結果添加的內容。 – Karl