开发者

jqgrid - how do I get a reference to the column's edittype element upon resizeStop event?

main goal: upon resizeStop, I need to resize the element's width inside the cell. e.g. edittype="select"

here's the scenario: 1) there's a jqgrid, has columns, let's say in column 3 has edittype="select". 2) user resize the column 3 3) after resizing, the resizeStop(newwidth, index) event 4) i开发者_Go百科nside the resizeStop event, want to get a reference to all select element of the given index. Then resize it appropriately.

problem: I don't know on how to implement the number 4... please guide me or give me hints to investigate. thanks in advanced.


Look at the getCol method it is probably what you need.


            resizeStop: function (newwidth, index) {
                var selectedRowId = jQuery("#jqgridElementId").getGridParam('selrow');
                if(selectedRowId) {
                    //resize combobox proportionate to column size
                    var selectElement = $('[id="' + selectedRowId + '_' + (index-1) + '"][role="select"]');
                    if(selectElement.length > 0){
                        $(selectElement).width(newwidth);
                    }
                }
            },
            onSelectRow: function(id){
                if(id ){

                    //resize combobox proportionate to column size
                    var rowSelectElements = $('[id^="' + id + '_"][role="select"]');
                    if(rowSelectElements.length > 0) {
                        $(rowSelectElements).each(function(index, element){
                            var name = $(element).attr('name');
                            var columnElement = $('#jqgridElementId_' + name);
                            if(columnElement.length > 0) {
                                var columnWidth = $(columnElement).width();
                                $(element).width(columnWidth);
                            }
                        });
                    }
                }
            }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜