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.

Column details at column template

Thread ID:

Created:

Updated:

Platform:

Replies:

124600 Jun 16,2016 07:23 AM Aug 1,2016 12:29 AM JavaScript 6
loading
Tags: ejGrid
Mohamed Elhamamsy
Asked On June 16, 2016 07:23 AM


I have a grid with unknown number of columns based on data stored in database.

These columns are with the same data type and the same format.

I need to create one columnTemplate for them, So in JsRender template I need some information to indicate what is the column index or the column name in order to render the related data.

I've found that Someone asked for this issue before in the following thread:

https://www.syncfusion.com/forums/119863/how-do-you-make-a-column-template-generic-for-use-with-more-than-one-column-in-an-ejgrid

and I'd like to know if this issue has been finished and how to use it.

Thanks in advance

Jayaprakash Kamaraj [Syncfusion]
Replied On June 17, 2016 01:08 PM

Hi Mohamed,  
 
Thank you for contacting Syncfusion support. 
We have fixed the issue in our latest version (14.1.0.46) and your requirement is achieved by using js render helper class in column template.  
We have created a sample using jsPlayground,  
$(function () { 
            $("#Grid").ejGrid({ 
                columns: [//column template 
                         { { field: "EmployeeID", template: "{{:~getModel()}}", headerText: "Employee ID", isPrimarykey: true, editType: ej.Grid.EditingType.NumericEdit, textAlign: ej.TextAlign.Right, width: 90 }, 
                                               { field: "FirstName",template: "{{:~getModel()}}",  headerText: "First Name", width: 90 },                          
                ] 
            }); 
        }); 
        $.views.helpers({//helper class 
            getModel: function () { 
               if (this.ctx.prop.field == "EmployeeID") 
                    return this.ctx.root.EmployeeID; 
                else 
                    return this.ctx.root.FirstName; 
            }
        }); 
 
Regards,                                                                                                                                                                               
Jayaprakash K.
 


Mohamed Elhamamsy
Replied On July 28, 2016 05:58 AM

Thanks a lot.
But I need also to know if this issue has been applied for treeGrid or not ?

Jayaprakash Kamaraj [Syncfusion]
Replied On July 29, 2016 08:42 AM

Hi Mohamed, 
Query : But I need also to know if this issue has been applied for treeGrid or not ? 
A support incident has been created under your account to resolve the issue. Please log on to our support website to check for further updates.  
 
Regards,
Jayaprakash K. 


Mohamed Elhamamsy
Replied On July 31, 2016 11:16 AM

Thank you very much.

Mohamed Elhamamsy
Replied On July 31, 2016 11:25 AM

Thank you very much.

Jayaprakash Kamaraj [Syncfusion]
Replied On August 1, 2016 12:29 AM

Hi Mohamed,  
 
Thanks for the update. 
Please get back to us if you need any further assistance.   
 
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.

;