This is a migrated thread and some comments may be shown as answers.

Grid batch editing - focus in second column on inserting new row

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jatin
Top achievements
Rank 1
Jatin asked on 15 Aug 2011, 08:34 AM
Hi,
   I am using Q2 grid whose first column is readonly. Hence, when inserting new record, I want to focus on the textbox in the second column, but that doesn't happen by default. The textbox appears only when I click the second column of the newly inserted row. Any ideas as to how I can focus directly in the second column of the newly inserted row, when the "Add New Record" button is clicked.

regards,
Nirvan

1 Answer, 1 is accepted

Sort by
0
Jatin
Top achievements
Rank 1
answered on 18 Aug 2011, 01:47 AM
One quick solution is to hook up to onEdit event of grid and then check the mode property of event argument. Then accordingly focus on wherever you want. Here is the code I have used.

In grid
.ClientEvents(events => events.OnEdit("TestOnEdit"))

In javascript
function TestOnEdit(e) {
    if (e.mode == 'insert') {
        $('.t-grid-new-row td:nth-child(2)').click();
    }
}

regards,
Nirvan.
Tags
Grid
Asked by
Jatin
Top achievements
Rank 1
Answers by
Jatin
Top achievements
Rank 1
Share this question
or