0
私は、複数の選択ボックスとテキストフィールドを持つjqGridを持っています。すべてのフォームフィールドを同じ長さにしたいと思います。フォームフィールドのすべてを、最も幅の広い選択ボックスまたはテキストフィールドのサイズにしたいと思います。私はこれを行うことができる方法はありますか?動的にサイズjqGridフォームフィールドを追加/編集
ご協力いただきありがとうございます。
私は、複数の選択ボックスとテキストフィールドを持つjqGridを持っています。すべてのフォームフィールドを同じ長さにしたいと思います。フォームフィールドのすべてを、最も幅の広い選択ボックスまたはテキストフィールドのサイズにしたいと思います。私はこれを行うことができる方法はありますか?動的にサイズjqGridフォームフィールドを追加/編集
ご協力いただきありがとうございます。
afterShowFormイベントを使用すると、最も幅の広い選択ボックスの幅を取得し、すべての選択幅を値に設定できます。
標準編集/
に
から対応するコード形式を追加demo変化:
var resizeSelectWidth = function ($form) {
var maxWidth = 0, newMaxWidth = 0, i,
$selects = $form.find('tr.FormData > td.DataTD > select.FormElement'),
cn = $selects.length;
// calculate the max width of selects
for (i = 0; i < cn; i += 1) {
maxWidth = Math.max(maxWidth, $($selects[i]).width());
}
maxWidth += 2; // increase width to improve visibility
// change the width of selects to the max width
for (i = 0; i < cn; i += 1) {
$($selects[i]).width(maxWidth);
newMaxWidth = Math.max(maxWidth, $($selects[i]).width());
}
};
...
$("#list").jqGrid('navGrid', '#pager', {del: true},
{afterShowForm: resizeSelectWidth},
{afterShowForm: resizeSelectWidth});
を