AngularJS Example:
HTML
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<div ng-app>
<div ng-controller="ReasonCtrl">
<table>
<tr ng-repeat="row in rows">
<td>
<select ng-model="Reason" ng-options="Reason for Reason in ReasonsChoice_normal"></select>
<select ng-model="Reason" ng-options="Reason for Reason in ReasonsChoice_ajax"></select>
</td>
</tr>
</table>
</div>
</div>
JavaScript
function ReasonCtrl($scope, $http, $timeout, $element) {
//shouldn't normally use $element, but illustrates the solution
$scope.rows = [1, 2, 3];
$scope.Reason = "Apple";
$scope.ReasonsChoice_normal = ["Apple", "Banana", "Carrot"];
$http({
method: 'POST',
url: '/echo/json/',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
transformRequest: function (obj) {
return "json=%5B%22Apple%22%2C%22Banana%22%2C%22Carrot%22%5D"
}
}).success(function (data) {
$scope.ReasonsChoice_ajax = data;
$timeout(function() {
$element.find("select").css("width", $element.find("select").css("width"));
}, 0);
});
}