我目前在工作中構建項目,要求我拉入對象數組,並將它們固定在地圖上。停止智能客戶端向我的陣列中添加Array類元素
我將我的標記存儲在數組中,以便在用戶搜索不同標準時重置地圖。
這一切都工作完美,直到我包括Smart Client
。
我不是很熟悉Smart Client
,但它似乎是將一個Array
類對象添加到我的數組,因此打破了我的for循環。
var wrap = (function() {
var arr;
function myFunc(a) {
for (var i in arr)
arr[i] = null; //doing this to set all markers to null
}
arr = [];
for (var i in a) {
arr.push(a[i]);
}
}
return {
doSomething: function(a) { myFunc(a); }
}
})();
wrap.doSomething([1,2,3,4]);
wrap.doSomething([1,2,3,4]);
這給我一個TypeError: undefined is not a function
錯誤。
smartclient library,smart gwt。 我已經包含下列文件。
<script>var isomorphicDir = "/smartclient/isomorphic/";</script>
<script src="/gmap/smartclient/isomorphic/system/modules/ISC_Core.js"></script>
<script src="/smartclient/isomorphic/system/modules/ISC_Foundation.js"></script>
<script src="/smartclient/isomorphic/system/modules/ISC_Containers.js"></script>
<script src="/smartclient/isomorphic/system/modules/ISC_Grids.js"></script>
<script src="/smartclient/isomorphic/system/modules/ISC_Forms.js"></script>
<script src="/smartclient/isomorphic/system/modules/ISC_DataBinding.js"></script>
<script src="/smartclient/isomorphic/skins/Enterprise/load_skin.js"></script>
無論在我自己的js之前還是之後初始化這些文件,我仍然會得到相同的錯誤。
我很樂意提供一個可行的替代方案,它提供了一個更好的/更乾淨的解決方案,可以在javascript中生成大型動態可排序表和可組表。
謝謝,其實我已經實現,在我的代碼,我剛剛也趕上了試圖讓使用SO輸入字段的格式正確。 – hamhut1066