w2grid.nextCell
更新日: 2018-09-06
nextCell(col_ind, editable)
次のセルか、行末の場合はnullを返します。 戻り値はintegerまたは、nullです。
- col_ind: string
- カラムのインデックス。
- editable: boolean
- 次のセルが編集可能かどうか?* 引数の役割が不明です。 
説明
第1引数のcol_indは.columns配列のインデックスです。
グリッドを以下のように定義すると
$('#grid').w2grid({
    name: 'grid2',
    columns: [                
        { field: 'recid', caption: 'ID', size: '50px' },
        { field: 'lname', caption: 'Last Name', size: '30%', editable: { type: 'text' } },
        { field: 'fname', caption: 'First Name', size: '30%', editable: { type: 'text' } },
        { field: 'email', caption: 'Email', size: '40%', editable: { type: 'text' } },
        { field: 'sdate', caption: 'Start Date', size: '120px', editable: { type: 'date' } },
        { field: 'edate', caption: 'End Date', size: '120px', editable: { type: 'date' } }
    ],
    records: [
        { recid: 1, fname: 'John', lname: 'doe', email: 'vitali@gmail.com', sdate: '1/3/2012' },
        { recid: 2, fname: 'Stuart', lname: 'Motzart', email: 'jdoe@gmail.com', sdate: '2/4/2012' },
        { recid: 3, fname: 'Jin', lname: 'Franson', email: '--', sdate: '4/23/2012' },
        { recid: 4, fname: 'Susan', lname: 'Ottie', email: 'jdoe@gmail.com', sdate: '5/3/2012' },
        { recid: 5, fname: 'Kelly', lname: 'Silver', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
        { recid: 6, fname: 'Francis', lname: 'Gatos', email: 'vitali@gmail.com', sdate: '2/5/2012' }
    ]
});以下のように指定します。
w2ui['grid2'].nextCell(3, true);デモ
キーを押すと3列目の次のカラムのインデックスがconsole.logに出力されます。
JavaScript
$('#grid').w2grid({
    name    : 'mygrid',
    columns : [
        { field: 'recid', caption: 'ID', size: '50px' },
        { field: 'lname', caption: 'Last Name', size: '30%' },
        { field: 'fname', caption: 'First Name', size: '30%' },
        { field: 'email', caption: 'Email', size: '40%' },
        { field: 'sdate', caption: 'Start Date', size: '120px' },
        { field: 'sdate', caption: 'End Date', size: '120px' }
    ],
    records: [
        { recid: 1, fname: 'John', lname: 'doe', email: 'vitali@gmail.com', sdate: '1/3/2012' },
        { recid: 2, fname: 'Stuart', lname: 'Motzart', email: 'jdoe@gmail.com', sdate: '2/4/2012' },
        { recid: 3, fname: 'Jin', lname: 'Franson', email: '--', sdate: '4/23/2012' },
        { recid: 4, fname: 'Susan', lname: 'Ottie', email: 'jdoe@gmail.com', sdate: '5/3/2012' },
        { recid: 5, fname: 'Kelly', lname: 'Silver', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
        { recid: 6, fname: 'Francis', lname: 'Gatos', email: 'vitali@gmail.com', sdate: '2/5/2012' }
    ],
});
w2ui['mygrid'].on('keydown', function(event) {
    w2ui['mygrid'].nextCell(3, true);
});
© 2017.  .
.
Code licensed under theMIT License. Documentation licensed underCC BY 3.0.
このコンテンツはvitmalinaによるw2ui.gridドキュメントを翻訳/改変したものです。