jqGrid - Grouping fields in edit form

前端 未结 1 1120
深忆病人
深忆病人 2020-12-10 21:28

It is possible to group some fields in the edit form?

I would like to group some fields together, give them a summarizing name and give the group some different backg

相关标签:
1条回答
  • 2020-12-10 21:51

    What you can do is almost free modifying of Add or Edit form inside of beforeShowForm callback. I demonstrate the idea on the demo which I quickly made for you. The example shows just an example of what you can do:

    enter image description here

    The corresponding code is

    $.extend($.jgrid.edit, {
        recreateForm: true,
        beforeShowForm: function($form) {
           $('<tr class="FormData"><td class="CaptionTD ui-widget-content" colspan="2">' +
               '<hr/><div style="padding:3px" class="ui-widget-header ui-corner-all">' +
               '<b>Invice information (all about money):</b></div></td></tr>')
               .insertBefore('#tr_amount');
           $('<tr class="FormData"><td class="CaptionTD ui-widget-content" colspan="2">' +
               '<hr/><div style="padding:3px" class="ui-widget-header ui-corner-all">' +
               '<b>Delivery information:</b></div></td></tr>')
               .insertBefore('#tr_closed');
        }
    });
    

    I set $.jgrid.edit only to change beforeShowForm for both "Add" in "Edit" forms. The 'amount' and 'closed' used in .insertBefore('#tr_amount')) and insertBefore('#tr_closed') are the column names from the colModel.

    0 讨论(0)
提交回复
热议问题