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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I Hide the PrimaryKey column and specify template

Thread ID:

Created:

Updated:

Platform:

Replies:

142558 Feb 10,2019 08:24 AM UTC Feb 12,2019 04:04 AM UTC JavaScript - EJ 2 3
loading
Tags: Grid
Samuel
Asked On February 10, 2019 08:24 AM UTC

I am using Javascript with webapi. the webapi is not that important here. its the Javascript, 
How do i hide the primary key column ? In another scenario, I want to specify the tem[plate for each row to use, how can i do that?

Thanks


Pavithra Subramaniyam [Syncfusion]
Replied On February 11, 2019 08:58 AM UTC

Hi Samuel, 
 
Thanks for contacting Syncfusion support.  
 
Query #1: How do i hide the primary key column ? 
 
You can hide any column by disabling the “column.visible” property. Please refer to the below code example and Documentation link. 
 
[index.cshtml]  
      var grid = new ej.grids.Grid({ 
        dataSource: data, 
        allowPaging: true, 
        columns: [ 
            { field: 'OrderID', headerText: 'ID', visible:false, textAlign: 'Right', width: 120, isPrimaryKey: true }, 
            { field: 'CustomerID', headerText: 'Custome ID', textAlign: 'Right', width: 120 }, 
            { field: 'EmployeeID', headerText: 'Employee ID', textAlign: 'Right' } 
        ] 
    }); 
 
    grid.appendTo('#Grid'); 
 
 
Query #2: In another scenario, I want to specify the template for each row to use, how can i do that? 
 
You can achieve your requirement by using the “column.template” which is used to render custom elements in grid cells of each row. Please refer to the below Documentation link and demo link for more information. 
 
                              https://ej2.syncfusion.com/javascript/documentation/grid/columns/#column-template  
 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Pavithra S. 


Samuel
Replied On February 11, 2019 09:14 AM UTC

Thank you so much, it worked as i integrated in your sample perfectly!

Thavasianand Sankaranarayanan [Syncfusion]
Replied On February 12, 2019 04:04 AM UTC

Hi Samuel, 
 
We are happy that the problem has been solved. 
 
Please get back to us if you need any further assistance.  
                          
Regards, 
Thavasianand S.

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon