Image ZK-组合框所选项目图像
任何人都知道在ZKImage ZK-组合框所选项目图像,image,combobox,icons,zk,Image,Combobox,Icons,Zk,任何人都知道在ZK组合框中显示带有所选项目的图像/图标的方法。例如,这显示了如何在下拉列表中的每个组合项上放置图像。但是,在本例中选择一个项目时,组合框将显示该项目的标签。。但不是图像。我认为这不可能。。。他们肯定会在文档中有一些参考,比如如何获得组合框中选定项值的图像等等。。。但是你试过论坛了吗?他们肯定会帮你的 当前您需要自定义它(将所选项目的图像节点复制到combobox)您自己,简单示例: <zk xmlns:w="client"> <style>
组合框中显示带有所选项目的图像/图标的方法。例如,这显示了如何在下拉列表中的每个组合项上放置图像。但是,在本例中选择一个项目时,组合框将显示该项目的标签。。但不是图像。我认为这不可能。。。他们肯定会在文档中有一些参考,比如如何获得组合框中选定项值的图像等等。。。但是你试过论坛了吗?他们肯定会帮你的 当前您需要自定义它(将所选项目的图像节点复制到combobox)您自己,简单示例:
<zk xmlns:w="client">
<style>
.z-combobox-inp,
.z-combobox-rounded-inp {
padding-left: 30px;
}
</style>
<combobox>
<attribute w:name="bind_"><![CDATA[
function (a, b, c) {
this.$bind_(a, b, c);
// anchor used to position selected image
var n = this.$n(),
ref = n.firstChild,
span = document.createElement('span');
jq(span).css('position', 'relative')
.addClass('custom-selected-image-anchor');
n.insertBefore(span, ref);
}
]]></attribute>
<attribute w:name="_hilite2"><![CDATA[
function (sel, opts) {
this.$_hilite2(sel, opts);
if (opts && opts.sendOnSelect && sel) {
var $anchor = jq(this.$n()).find('.custom-selected-image-anchor');
$anchor.find('.custom-selected-image')
.each(function () {
this.parentNode.removeChild(this);
});
$anchor[0].appendChild(
jq(sel.getImageNode()).clone() // clone node
.css({'position': 'absolute', // add style
'left': '0px',
'top': '3px'}) // also add class
.addClass('custom-selected-image')[0]
);
}
}
]]></attribute>
<comboitem label="test" image="images/battery.gif" />
<comboitem label="test 2" image="images/left_arrow.png" />
</combobox>
</zk>
.z-combobox-inp,
.z-combobox-rounded-inp{
左侧填充:30px;
}
所选项目位于
HTML标记中,我认为您无法向其添加图像。我认为如果你想这样做,你必须操作zk组件。也许是一个很好的功能要求。