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.
Unfortunately, activation email could not send to your email. Please try again.

Build columns of grid through service in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

120987 Oct 31,2015 08:54 AM Nov 4,2015 05:15 AM JavaScript 4
loading
Tags: ejGrid
Gomtesh
Asked On October 31, 2015 08:54 AM

Hi,
I have to bind remote data to grid but columns of the grid should build thought separate API call
i have build columns in using e-create but the columns not creating in that way

Here i have created sample on JS playGround please check,

Sample

http://jsplayground.syncfusion.com/wzbau2zg


Jayaprakash Kamaraj [Syncfusion]
Replied On November 2, 2015 06:27 AM

Hi Gomtesh,

Currently we don’t have support to refresh the columns in angular JS. We have considered
 “Refresh columns in angular JS” as an improvement task and it is estimated to be included in our Vol 3, 2015 Service Pack 2 release which is expected to be roll out at the end of month October, 2015. We have tried to achieve the requirement using column method. In this method, we have added or removed columns in Grid column collections. Please refer to the code example, 

$scope.databound = function () {

                custService.get().then(


                                 function (response) {

                                     var columns = response.data;                                                        var gridObj = $("#Grid").data("ejGrid");

                                     var colField=[];

                               for (var i = 0; i < gridObj.model.columns.length;i++){

                                         colField.push(gridObj.model.columns[i].field)

                                     }

                                     for (var i = 0; i < columns.length; i++)

                                                                 colField.splice(colField.indexOf(columns[i]),1)

gridObj.columns(colField, "remove");

                                 }

                            )
            }


Sample,

http://www.syncfusion.com/downloads/support/forum/120987/ze/ServerOperations1929213928
 
Refer to UG Document for more details, 
http://help.syncfusion.com/js/api/ejgrid#methods:columns

A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates. 


https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents 


Regards,

Jayaprakash K.


Gomtesh
Replied On November 3, 2015 03:53 AM

Hi Jayaprakash,

gridObj.columns(colField, "remove");

As you given solution for removing columns  but i have used column chooser for that i hvae to only show and hide columns at service call i.e. custService.get().then(

and in column chooser i have to show all columns.


Gomtesh
Replied On November 3, 2015 03:56 AM

Hi Jayaprakash,

gridObj.columns(colField, "remove");

As you given solution for removing columns  but i have used column chooser for that i hvae to only show and hide columns at service call i.e. custService.get().then(

and in column chooser i have to show all columns.


For tha i dont want to remove columns if remove columns then in column chooser i will not get all column fields

Jayaprakash Kamaraj [Syncfusion]
Replied On November 4, 2015 05:15 AM

Hi Gomtesh,

We have achieved your requirement using “visible” property in columns, which is used to get or set a value that indicates whether the column is visible or not in Grid. Columns can be returned from the server side. In this columns method, set visible property as false for hide columns. Please refer to the code example and Help document as below,
Code example:

                custService.get().then(


                function (response) {                            

                    var gridObj = $("#Grid").data("ejGrid");

//here i got 'data'  following manner  fields, headetext, alignments and visible

                     gridObj.columns(response.data);

                     $("#Grid").ejGrid("model.showColumnChooser", true);

                                 }

            )

Help document:

Columns : http://help.syncfusion.com/js/api/ejgrid#methods:columns

Visible : http://help.syncfusion.com/js/api/ejgrid#members:columns-visible

sample : http://www.syncfusion.com/downloads/support/forum/120987/ze/ServerOperations-883327696

Regards,

Jayaprakash K.



CONFIRMATION

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.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;