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

Column details at column template


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

6 Replies

JK Jayaprakash Kamaraj Syncfusion Team June 17, 2016 12: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.
 



ME Mohamed Elhamamsy July 28, 2016 04:58 AM

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


JK Jayaprakash Kamaraj Syncfusion Team July 29, 2016 07: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. 



ME Mohamed Elhamamsy July 31, 2016 10:16 AM

Thank you very much.


ME Mohamed Elhamamsy July 31, 2016 10:25 AM

Thank you very much.


JK Jayaprakash Kamaraj Syncfusion Team July 31, 2016 11:29 PM

Hi Mohamed,  
 
Thanks for the update. 
Please get back to us if you need any further assistance.   
 
Regards, 
Jayaprakash K. 


Loader.
Live Chat Icon For mobile
Up arrow icon