У меня следующий запрос к JSON: выбранная опция не работает в IE, а работает в Firefox.
У меня есть пример данных, таких как:
var columnDefs = [...
{"name":"childPerformancePrice", "label":"Cosell Price", "type":"int", "control":"select", "options":performancePrices, "align":"left", "default":"", "required":false,"size": 6},
...]
Раскрывающийся список производительности, например:
function getPerformancePrices(){
......
$.getJSON("?data=performancePrices", function(list) {
performancePrices.push([0, ""]);
$.each(list, function(index, item) {
performancePrices.push([item.id, item.description]);
performancePrices.sort();
});
...
});
}
пример данных JSON, таких как JSON.stringify(columnDefs[index])
:
{"name":"childPerformancePrice", "label":"Cosell Price", "type":"int", "control":"select", "options":[[0,""],[15000,"Band 1"],[15001,"Band 2"],[15002,"Band 3"]],"align":"left", "default":"", "required":false,"size": 6}
Вопрос: почему выбранная ниже опция во время редактирования не работает (то есть, не выбирается правильно в IE) в IE, покахорошо работает в Firefox?
function selectCell(oColumnDef, value) {
var oSelect = createNamedElement("select", oColumnDef["name"]);
if (value == undefined) {
value = "";
}
$.each(oColumnDef["options"], function(index, item) {
var oOption = document.createElement("option");
oOption.value = item[0];
oOption.text = item[1];
if (item[1] == value) {
oOption.selected = true;
}
oSelect.options.add(oOption);
});