<div class="content-container-fluid"> <div class="row"> <div class="cols-sample-area">
<input id="bookSelect" ej-dropdownlist e-datasource="dataList" e-value="value" e-change="onchange" />
<div id="Grid" ej-grid e-datasource="data" e-columns="col" e-selectedrowindex="selectedRow" e-allowgrouping="true" e-pagesettings-pagesize="8" e-pagesettings-currentpage="page" e-allowsorting="true" e-allowpaging="true" e-actionbegin="actionBegin"> <div e-toolbarsetting-showtoolbar=true>
</div>
</div> </div> <script>
var list = [ { text: "data1", value: "data1" }, { text: "data2", value: "data2" },
]; var col1 = [ { field: "EmployeeID", isPrimaryKey: true, headerText: "EmployeeID", textAlign: ej.TextAlign.Right, width: 90 }, { field: "LastName", headerText: 'LastName', width: 90 }, { field: "FirstName", headerText: 'FirstName', textAlign: ej.TextAlign.Right, width: 75 }, { field: "Freight", headerText: 'Freight', textAlign: ej.TextAlign.Right, width: 75, format: "{0:C}" }, { field: "Title", headerText: 'Title', width: 90 }, { field: "City", headerText: 'City', width: 90 } ]; var col2 = [ { field: "EmployeeID", isPrimaryKey: true, headerText: "EmployeeID", textAlign: ej.TextAlign.Right, width: 90 }, { field: "LastName", headerText: 'LastName', width: 90 }, { field: "FirstName", headerText: 'FirstName', textAlign: ej.TextAlign.Right, width: 75 }, ]; |
<input id="bookSelect" ej-dropdownlist e-datasource="dataList" e-value="value" e-change="onchange" /> angular.module('listCtrl', ['ejangular']) .controller('PhoneListCtrl', function ($scope) { $scope.selectedRow = 2; $scope.page = 2; $scope.data = data1; $scope.dataList = list; $scope.col = col1; //dropdown change event $scope.onchange = function (args) { if (args.text == "data2") { $scope.data = data2; $scope.col = col2; } else { $scope.data = data1; $scope.col = col1; } $scope.$apply(); //apply changes };
}); |