This is a migrated thread and some comments may be shown as answers.
How to set selection programmatically?
1 Answer 23 Views
This is a migrated thread and some comments may be shown as answers.
Kajal
Top achievements
Rank 1
Kajal asked on 18 Sep 2018, 04:13 AM

Hi,

I have a fixed set of rows in spreadsheet. Whenever a row is deleted from this spreadsheet, the next row in sequence is selected. 

But when I try to delete the last row of the spreadsheet, I want the previous row in sequence to be selected.

Is there a way to set a specific row as selected post deletion? 

 

Thanks

Kajal

1 Answer, 1 is accepted

Sort by
0
Accepted
Neli
Telerik team
answered on 19 Sep 2018, 02:52 PM
Hi Kajal,

It is not possible to select a row programmatically in the spreadsheet, but you could select specific range. To achieve the desired behavior you could subscribe to the deleteRow event. In the event handler, you could check the index of the deleted row. Then you could select a range that is on the previous row.
deleteRow: function(e){
var index = e.index            
var sheet = e.sender.activeSheet();
var rangeString = 'A'+index +':'+'G'+index
sheet.range(rangeString).select();
},
Here is a Dojo example where the above is implemented. 


Regards,
Neli
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Kajal
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or