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

Select Row dynamically

Thread ID:

Created:

Updated:

Platform:

Replies:

149079 Nov 13,2019 07:24 PM UTC Nov 14,2019 06:52 AM UTC Vue 1
loading
Tags: Data Grid
William Morgenweck
Asked On November 13, 2019 07:24 PM UTC

I have a grid with the following information:
                 <ejs-grid
                  id="reportGrid"
                  ref="reportGrid"
                  :allowSelection="true"
                  :dataSource="articles"
                  :rowSelected="onRowSelectedPubs"
                  :toolbar="toolbarOptions"
                  :allowTextWrap="true"
                  :allowExcelExport="true"
                  :allowPdfExport="true"
                  :recordDoubleClick="pubDoubleClick"
                  :selectionSettings="selectOptions"
                  :toolbarClick="toolbarClick"
                >
And I need to select a row via code.  I have tried

               var obj = $("#reportGrid").data("ejs-grid");
                obj.selectRow(5, true);

and 

              

this.$refs.reportGrid.selectRow(0);

the information  at 
https://ej2.syncfusion.com/vue/documentation/api/grid/?_ga=2.115438726.1453351565.1573582025-616283409.1556326607#selectrows 

does not give very much help





Pavithra Subramaniyam [Syncfusion]
Replied On November 14, 2019 06:52 AM UTC

Hi William, 
 
Thanks for contacting Syncfusion support. 
 
We have checked your code and to access the Grid methods in Vue you can use the reference as given below. Please refer to the below code example and sample link for more information. 
 
In the below sample we have selected the row in a button click event which is working fine at our end. 
 
[App.Vue] 
<template> 
  <div id="app"> 
    <ejs-button id="enable" cssClass="e-flat" @click.native="enable">Select</ejs-button> 
    <ejs-grid 
      id="reportGrid" 
      ref="reportGrid" 
      :actionFailure="fail" 
      :allowSelection="true" 
      :dataSource="data" 
      :allowTextWrap="true" 
      :allowExcelExport="true" 
      :allowPdfExport="true" 
      :selectionSettings="selectOptions" 
    > 
      <e-columns> 
       .   .   . 
      </e-columns> 
    </ejs-grid> 
  </div> 
</template> 
 
<script> 
.   .   . 
export default { 
  data() { 
    return { 
      data: data, 
      selectOptions: { type: "Single" } 
    }; 
  }, 
  methods: { 
    fail: e => { 
      debugger; 
    }, 
    enable: function() { 
      this.$refs.reportGrid.ej2Instances.selectRow(5true); 
    } 
  } 
}; 
</script> 
 
 
If you are still facing the issue please provide the below details that will be helpful for us to provide a better solution as early as possible.  
 
  1. Share the full code related to Grid
  2. Share the Syncfusion version
  3. Share the stack trace if any
  4. Please reproduce the issue in the above sample if possible.
 
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