jQuery - jQGrid - expand,collapse subgrid on grid row click

梦想的初衷 提交于 2019-12-06 04:56:40
Oleg

I haven't tested it, but it seems to me that the following code should do what you need:

onSelectRow: function (rowId) {
    $("#jqgrid_id").jqGrid ('toggleSubGridRow', rowId);
}

(see jqGrid documentation)

i needed the same thing, but i couldn't permit the grid to be expanded in the case where it was already collapsed, so the 'toggleSubGridRow' wouldn't work for me. Better in the situation where only a collapse should be permitted is the 'collapseSubGridRow' method.

onSelectRow: function (rowId) {
    $("#jqgrid_id").jqGrid ('collapseSubGridRow', rowId);
}

it wasn't working for me at first xD... I've set selectOnExpand on my subGridOptions, so every time I click an expand it select the row and call onSelectRow once again ahaha... so funny...

Hope this help some fool like me there :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!