gpt4 book ai didi

jqgrid - 在 jqgrid header 中设置图像

转载 作者:行者123 更新时间:2023-12-04 18:14:16 25 4
gpt4 key购买 nike

任何人都知道是否可以在 jqgrid 的列标题之一中设置图像?

我尝试了以下方法:

$("#jqgh_Jqgrid_1_t_TEST").prepend("<img src='...' alt='test' />");

我认为这可能有效,但是什么时候应该调用该函数?

最佳答案

正如 Piyush 提到的,这可以使用 setLabel 来完成。方法。来自 method documentation :

setLabel

colname, data, class, properties

Sets a new label in the header for the specified column; can also set attributes and classes . The parameters are:

  • colname the name of the column (this parameter can be a number (the index of the column) beginning from 0
  • data the content that can be put into the label. If empty string the content will not be changed
  • class if class is string then we add a class to the label using addClass; if class is an array we set the new css properties via css
  • properties sets the attribute properies of the label


这是一个如何使用 setLabel 的示例显示图像:
jQuery(myGrid).jqGrid('setLabel', 
'myColName',
'<img src=images/my-image.png width=16 height=16>');

您可能希望将高度设置为 16 像素左右,使其与网格文本具有相同的高度,如本例所示,但这完全取决于您。

关于jqgrid - 在 jqgrid header 中设置图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12025267/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com