Jqgrid模态Colspan [英] Jqgrid Modal Colspan

查看:190
本文介绍了Jqgrid模态Colspan的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将colspan属性应用于JQgrid模态窗口内的td.它使用以下结构来呈现模态形式

I'd like to apply a colspan attribute to a td inside the JQgrid modal window. It renders the modal form with the following structure

<form ...>
  <table ...>
    <tbody>
       <tr ...>
         <td class="CaptionTD"></td>
         <td class="DataTD"></td>
         <td class="CaptionTD"></td>
         <td class="DataTD"></td>
       </tr>
    </tbody>
  </table>
</form>

我已经查看了所有可用的选项,但我不清楚如何将colspan属性应用于任何td.我正在阅读将一些样式添加到单元格的方法,例如使用"classes"选项,但是据我所知(根据我的研究...如果可以这样称呼),则无法使用CSS设置表格的colspan因为它不是一种样式,而是一种表的结构更改"

I've looked at all the options available, but i'm unclear on how to apply a colspan attribute to any of the td's. I was reading into appending some style to the cell, eg using the "classes" option, but as far as i know (based on my research... if you can call it that) you can't set a table's colspan using CSS as it's not seen as a style, but rather a "structural change to the table"

推荐答案

您是否使用rowpos和colpos属性? id = wiki:common_rules#formoptions"rel =" nofollow noreferrer> formoptions 并想隐藏第二个标签列?您能提供一个代码示例来说明在什么情况下使用colspan会很好吗?

Do you use rowpos and colpos properties of formoptions and like to hide the second label column? Could you provide a code example which shows in which situation the usage of colspan would be good?

通常,您可以在beforeShowForm回调内部设置colspan属性.可以使用类似的东西

In general you can set colspan attribute inside of beforeShowForm callback. One can use something like

// in the below example the column name is 'name'
$("#tr_name>td:eq(1)").attr("colspan", "2");
$("#tr_name>td:eq(1)>input").css("width", "95%");
$("#tr_name>td:eq(0)").hide();

或类似的

beforeShowForm: function () {
    var $tr = $("#tr_name"), // 'name' is the column name
        $label = $tr.children("td.CaptionTD"),
        $data = $tr.children("td.DataTD");
    $data.attr("colspan", "2");
    $data.children("input").css("width", "95%");
    $label.hide();
}

通常,如果在<td>上设置了colspan=2,则将同一行中的以前的<td>元素隐藏起来.

Typically if you set colspan=2 on <td> then one hide some previous <td> element in the same row.

结果是可以得到类似的东西

As the result one can get something like

这篇关于Jqgrid模态Colspan的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆