How to set selection programmatically?

2 posts, 1 answers
  1. Kajal
    Kajal avatar
    4 posts
    Member since:
    Feb 2014

    Posted 17 Sep 2018 Link to this post

    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

  2. Answer
    Neli
    Admin
    Neli avatar
    333 posts

    Posted 19 Sep 2018 Link to this post

    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.
Back to Top