We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ejGrid javascript gridObj.hideColumns("Id");

I am trying to hide a column in an ejGrid using javascript. The best I can get is that it actually hides the Id column and itdoes show the remaining columns names but it does not render the data. It informs that there are 40 records but displays none. The hide column function is being called on the actionComplete event of the ejGrid:actionComplete: "ActionComplete". This runs he following function:
function ActionComplete(args) {
var gridObj = $("#Grid").ejGrid("instance");
if (args.requestType == "refresh") {
Also, it takes several seconds before it finishes the above, incomplete, process. When I run the grid load process without trying to hide the Id column it takes about a second. The grid is being loaded via a datamanager. I am using Syncfusion.EJ version14.3450.0.52. Any ideas?

1 Reply

JK Jayaprakash Kamaraj Syncfusion Team December 6, 2016 11:24 AM UTC

Hi Stephen, 

Thank you for contacting Syncfusion support. 
In Grid, we have called refreshContent() in hideColumns method. So, the grid will be refreshed again and also actionComplete event will be triggered with requestType as refresh. To overcome this problem we suggest you to set flag variable and perform the action accordingly. Please refer to the below code example and sample. 

var flag = true; 
        $(function () { 
               actionComplete : function(args){ 
                           var gridObj = $("#Grid").ejGrid("instance"); 
if (args.requestType == "refresh" && flag == true) { 
flag = false; 
                editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, editMode: "batch" }, 
                toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] }, 
                columns: [ 
                         { field: "OrderID", isPrimaryKey: true, headerText: "Order ID", textAlign: ej.TextAlign.Right, validationRules: { required: true, number: true }, width: 90 }, 
..                ] 


Jayaprakash K. 

Live Chat Icon For mobile
Up arrow icon