|
<button id="start" ej-button e-showroundedcorner="true" e-size="large" e-text="Choose Columns" e-click="columnChooserclick"></button>
<div class="cols-sample-area">
<div id="Gridsds" ej-grid e-datasource="data" e-showcolumnchooser="true" e-databound="GriddataBound" e-allowpaging="true" >
<div e-columns>
----
</div>
</div>
</div>
angular.module('listCtrl', ['ejangular'])
.controller('PhoneListCtrl', function ($scope) {
$scope.data = obj;
$scope.GriddataBound = "GridDataBound";
$scope.columnChooserclick = "columnChooserClick";
});
// prevent default button for column chooser
function GridDataBound(args){
var proxy = this;
setTimeout(function () {
$(".e-ccButton").addClass("e-hide");
proxy.element.css("margin-top", "0px")
}, 0)
}
// shown a dialog externally for column chooser
function columnChooserClick(args){
var proxy = $(".e-grid").ejGrid("instance");
var top = this.element.offset().top, left = this.element.offset().left + 250;
var dlgWidth = 230;
if ($("#" + proxy._id + "ccDiv").length && proxy.element.find(".e-ccButton").length) {
//check whether column chooser elements exisiting or not
$("#" + proxy._id + "ccDiv").ejDialog({//id of column chooser dialog Grid’s ID + ccDiv
width: '230px',
height: '309px',
position: {
X: (proxy.model.enableRTL ? (left - dlgWidth + 143) : (left - dlgWidth)),
Y: top + this.element.height() + 10
}
}).ejDialog("open");
$("#" + proxy._id + "liScrollerDiv").ejScroller({ height: '228', width: '228', buttonSize: 0 });
$("#" + proxy._id + "liScrollerDiv").ejScroller('refresh');
}
}
|
|
// Button click event
onClick(args) {
// Specify the required X and Y axis value to display the column chooser at that position
this.gridObj.columnChooserModule.openColumnChooser(160, 240);
} |