我想建立一個表,其中列之一被選中,我想選擇與我從服務器獲得的值的選項。 我從服務器獲取4,但選擇的是第一個選項。Angularjs ng格與選擇單元格沒有選擇正確的值
$scope.lotteryOptions = {
data: 'myData',
enableColumnResize: true,
keepLastSelected: false,
enableRowSelection: false,
columnDefs: [{field: 'field1', displayName: 'field1'},
{field: 'Status', displayName: 'Status', cellTemplate: selectTableTemplate, enableCellEdit: true},
};
var selectTableTemplate = "<select ng-selected=\"{{row.getProperty('Status')}}\"> <option value='1' class='ng-binding'>" + 1+ "</option>" +
"<option value='2' class='ng-binding'>" + 2 + "</option>" +
"<option value='3' class='ng-binding'>" + 3 + "</option>" +
"<option value='4' class='ng-binding'>" + 4 + "</option>" +
"<option value='5' class='ng-binding'>" + 5 + "</option>" +
"<option value='6' class='ng-binding'>" + 6 + "</option></select>";
HTML結果是:
<select ng-selected="4">...</select>
但不選擇4選擇
謝謝!它的工作 – Asaf