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

Show rowheader with number

Thread ID:

Created:

Updated:

Platform:

Replies:

147824 Sep 25,2019 06:51 AM UTC Oct 8,2019 12:11 PM UTC Vue 7
loading
Tags: Data Grid
Michael Kornatzki
Asked On September 25, 2019 06:51 AM UTC

Hi,
is it possible to show a rowheader in a grid?

Kind regards,
michael

Pavithra Subramaniyam [Syncfusion]
Replied On September 26, 2019 07:16 AM UTC

Hi Michael, 
 
Greetings from Syncfusion support. 
 
From your query we understood that you want to show the number for each row in Grid. If so you can achieve your requirement by using the column template. Please refer to the below code example, documentation link and sample link for more information. 
 
In the below sample we have added the row index as row header in each row. 
 
[index.cshtml] 
<template> 
  <div id="app"> 
    <ejs-grid 
      id="Grid" 
      ref="grid" 
      :rowDataBound="rowDataBound" 
      :dataSource="data" 
      :allowPaging="true" 
    > 
      <e-columns> 
       // if you have the rowheader value in dataSource then you can set by adding <span>${fieldName}</span> 
        <e-column width="80" headerText="S.NO" template="<span></span"></e-column> 
        <e-column field="OrderID" headerText="Order ID" width="90"></e-column> 
        <e-column field="Freight" headerText="Freight" format="C2" width="90"></e-column> 
      </e-columns> 
    </ejs-grid> 
  </div> 
</template> 
 
<script> 
.    .   . 
  methods: { 
    rowDataBound: function(e) { 
      var data = this.$refs.grid.ej2Instances.getRowObjectFromUID( 
        e.row.getAttribute("data-uid"); // getting the row details 
      ); 
      e.row.getElementsByTagName("span")[0].innerText = data.index; 
    } 
  } 
}; 
</script> 



 
 
 
 
 Sample              : https://codesandbox.io/s/vue-template-zt1v0 

Please get back to us if you need any further assistance on this. 
 
Regards, 
Pavithra S. 


Michael Kornatzki
Replied On September 26, 2019 10:35 AM UTC

Thank you.

Pavithra Subramaniyam [Syncfusion]
Replied On September 26, 2019 11:35 AM UTC

Hi Michael, 
 
Thanks for your update. 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Pavithra S. 


Michael Kornatzki
Replied On October 7, 2019 10:58 AM UTC

Hi,

after the test with numbered rowHeader works i try to make the column fixed.
In my example i have 9 rows (frozenColumns=0) and if i use a fixedColumn (frozenColumns=1) then i get zero rows and the grid is corrupt!

Kind regards,
Michael

frozenColumn=0

frozenColumn=1


Attachment: App_f9f068dd.zip

Pavithra Subramaniyam [Syncfusion]
Replied On October 8, 2019 10:40 AM UTC

Hi Michael, 
Thanks for your update. 
You can achieve your requirement by using queryCellInfo event. 
Please refer to the below code example and sample. 
 
<ejs-grid 
     :queryCellInfo="queryCellInfo" 
     :dataSource="data" 
     :frozenRows="rows" 
     :frozenColumns="columns" 
. . .   > 
      <e-columns> 
        <e-column width="80" headerText="S.NO" template="<span></span"></e-column> 
. . . 
      </e-columns> 
</ejs-grid> 
 
export default { 
  data() { 
    return { 
      data: data, 
      rows: 2, 
      columns: 1 
    }; 
  }, 
  provide: { 
    grid: [Page, Freeze] 
  }, 
  methods: { 
    queryCellInfo: function(e) { 
      if (e.column.headerText === "S.NO") 
        e.cell.getElementsByTagName("span")[0].innerText = e.cell.getAttribute( 
          "index" 
        ); 
    } 
 
 
 
Regards, 
Pavithra S. 


Michael Kornatzki
Replied On October 8, 2019 11:45 AM UTC

Thanks, it works :)

Pavithra Subramaniyam [Syncfusion]
Replied On October 8, 2019 12:11 PM UTC

Hi Michael, 

Thanks for your update. 

We are happy to hear that the provided solution is working. 

Please get back to us if you need any further assistance on this. 

Regards, 
Pavithra 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