Skip to main content
jctremblay
Community Expert
Community Expert
March 12, 2017
Answered

How to select a row in a table from cursor position

  • March 12, 2017
  • 1 reply
  • 1373 views

Hi,

This is probably simple, but I can’t find how.

I need a snippet that will select and entire row from the location of the insertion of the cursor. Similar to the InDesign «Select Row» command.

Sorry for the newbie question.

This topic has been closed for replies.
Correct answer Trevor:

Hi Jean-Claude

function selectRow(s) {

    s = s || app.selection[0];

    if (!s) {

        return 'no selection';

    }

    while (s.constructor !== Cell){

        s = s.parent;

        if (s.constructor === Application) {

            return 'no cell found';

        }

    }

    s.parentRow.select();

}

selectRow();

HTH

Trevor

1 reply

Trevor:
Trevor:Correct answer
Legend
March 12, 2017

Hi Jean-Claude

function selectRow(s) {

    s = s || app.selection[0];

    if (!s) {

        return 'no selection';

    }

    while (s.constructor !== Cell){

        s = s.parent;

        if (s.constructor === Application) {

            return 'no cell found';

        }

    }

    s.parentRow.select();

}

selectRow();

HTH

Trevor

jctremblay
Community Expert
Community Expert
March 12, 2017

Thanks Trevor... That did it!