Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
146558 | Aug 8,2019 07:51 AM UTC | Aug 14,2019 04:26 AM UTC | AngularJS | 3 |
![]() |
Tags: ejGrid |
<div id="Grid" ej-grid e-datasource="data" e-editsettings="edit" e-toolbarsettings="tools" e-databound="databound" e-actionbegin="begin" e-toolbarclick="onToolBarClick" >
<div e-columns>
……………………………..
</div>
</div>
<script id="Refresh" type="text/x-jsrender">
<input id="unitCalc" type="text" />
</script>
<script>
angular.module('listCtrl', ['ejangular'])
.controller('PhoneListCtrl', function ($scope) {
$scope.data = window.gridData;
$scope.tools = { showToolbar: true,
toolbarItems: ["add","edit","delete","update","cancel"],
customToolbarItems: [{ templateID: "#Refresh" }] };
$scope.edit = { allowEditing: true, allowAdding: true, allowDeleting: true };
$scope.databound = function(args){
………………………………………………..
$("#unitCalc").ejNumericTextbox({ // render the numeric textbox in the dataBound event
value: 1, // sets value
minValue: 1, // sets min value
maxValue: 5, // sets max value
enableStrictMode: true // sets strict mode to true
});
};
………………………..
});
|
<body ng-controller="PhoneListCtrl">
<div id="Grid" ej-grid e-datasource="data" e-editsettings="edit" e-toolbarsettings="tools" e-databound="databound" e-actionbegin="begin" e-toolbarclick="onToolBarClick" >
<div e-columns>
…………
</div>
</div>
<script id="Refresh" type="text/x-jsrender">
<input id="unitCalc" type="text" />
</script>
<script>
angular.module('listCtrl', ['ejangular'])
.controller('PhoneListCtrl', function ($scope) {
$scope.data = window.gridData;
$scope.tools = { showToolbar: true,
toolbarItems: ["add","edit","delete","update","cancel"],
customToolbarItems: [{ templateID: "#Refresh" }] };
$scope.edit = { allowEditing: true, allowAdding: true, allowDeleting: true };
$scope.databound = function(args){
// custom items
var liElem = this.element.find(".e-gridtoolbar ul:eq('1') li");
//default items
var firstUl = this.element.find(".e-gridtoolbar ul:eq(0)");
for (var l = 0 ; l < 1; l++) {
//moving only two icons to front
//leaving the last icon
firstUl.prepend($(liElem[l]).detach());
}
………………………………
};
………………………………..
});
|
<body ng-controller="PhoneListCtrl">
<div id="Grid" ej-grid e-datasource="data" e-editsettings="edit" e-toolbarsettings="tools" e-databound="databound" e-actionbegin="begin" e-toolbarclick="onToolBarClick" >
<div e-columns>
…
</div>
</div>
..
<script>
angular.module('listCtrl', ['ejangular'])
.controller('PhoneListCtrl', function ($scope) {
……………………
};
$scope.begin = function(args){
if(args.requestType == "add"){
if(this.model.dataSource().length > 10){ // it will work only for local data.
args.cancel = true; // we have prevent the new record addition when the dataSource length is greater than
}
}
};
});
|
<body ng-controller="PhoneListCtrl">
<div id="Grid" ej-grid e-datasource="data" e-allowpaging=true e-editsettings="edit" e-toolbarsettings="tools" e-databound="databound" e-beforeBatchAdd="beforeBatchAdd" e-toolbarclick="onToolBarClick" >
<div e-columns>
…………………………………
</div>
</div>
…………………………
<script>
angular.module('listCtrl', ['ejangular'])
.controller('PhoneListCtrl', function ($scope) {
………………………………………………………………….
$scope.edit = { allowEditing: true, allowAdding: true, allowDeleting: true, editMode:"batch" };
………………………………………………………..
$scope.beforeBatchAdd = function(args){
if(this.getBatchChanges().added.length){
if(this.getBatchChanges().added.length >= 1 || this.model.dataSource().length > 201){ // set your condition here.
args.cancel = true; // prevent the new record addition
}
}
};
});
</script>
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.