-
FEATURED COMPONENTS
First time here? Check out the FAQ!
<window id="dmsanpham" border="none"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('com.evnit.fmis.masterdata.viewmodel.DMsanphamVM')">
<div sclass="z-toolbar">
<hlayout id="ctlhlayout">
<button id="btnNew" width="50px"
onClick="@command('onNew')" tooltiptext="thêm"
image="/images/icons/btn_new2_16x16.gif" />
<button id="btnEdit" width="50px"
onClick="@command('onEdit')" tooltiptext="sửa"
disabled="@load(empty vm.sanPham)"
image="/images/icons/btn_edit2_16x16.gif" />
<button id="btnDelete" width="50px"
onClick="@command('onDelete')" tooltiptext="xóa"
disabled="@load(empty vm.sanPham)"
image="/images/icons/btn_delete2_16x16.gif" />
<button id="btnSave" width="50px"
onClick="@command('onSave')" tooltiptext="ghi" disabled=""
image="/images/icons/btn_save2_16x16.gif" />
<button id="btnCancel" width="50px"
onClick="@command('onCancel')" tooltiptext="hủy bỏ" disabled=""
image="/images/icons/btn_cancel2_16x16.gif" />
</hlayout>
</div>
<groupbox>
<grid sclass="myform" style="margin-top:5px;"
form="@id('sp') @load(vm.sanPham)
@load(vm.sanPham, after={'onNew','onCancel'})
@save(vm.sanPham, before={'onSave','onEdit','onDelete'})">
<columns>
<column width="100px" align="right" />
<column width="25%" align="left" />
<column width="100px" align="right" />
<column align="left" />
</columns>
<rows>
<row>
<hbox>
<label value="Mã sản phẩm" />
<label value="*"
style="color:red;font-size:10px" />
</hbox>
<textbox id="txtMaSP" hflex="1"
value="@bind(sp.masp)" maxlength="15" />
<hbox>
<label value="Tên sản phẩm" />
<label value="*"
style="color:red;font-size:10px" />
</hbox>
<textbox id="txtTenSP" hflex="1"
value="@bind(sp.tensp)" maxlength="250" />
</row>
<row>
<label value="Tên tắt" />
<textbox id="txtTentat" hflex="1"
value="@bind(sp.tentat)" maxlength="15" />
<label value="Bộ phận" />
<listbox id="txtBophan" mold="select" rows="1"
model="@load(vm.phongBanList)" hflex="1"
selectedItem="@bind(sp.dmPhongBan)">
<template name="model">
<listitem value="@load(each)"
label="@load(each.tenpb)" />
</template>
</listbox>
</row>
<row>
<label value="Đơn vị tính" />
<listbox id="txtDVtinh" mold="select" rows="1"
model="@load(vm.donViTinhList)" hflex="1"
selectedItem="@bind(sp.dmDonViTinh)">
<template name="model">
<listitem value="@bind(each)"
label="@load(each.ten)" />
</template>
</listbox>
<label value="Loại sản phẩm" />
<textbox id="txtLoaiSP" hflex="1" />
</row>
</rows>
</grid>
</groupbox>
<groupbox>
<listbox model="@load(vm.sanPhamList)" id="list"
emptyMessage="Không có sản phẩm" mold="paging" height="100px"
pagingPosition="top" selectedItem="@bind(vm.sanPham)">
<listhead menupopup="auto" sizable="true">
<listheader width="10%" label="Mã sản phẩm"
sort="auto(masp)" />
<listheader width="20%" label="Tên sản phẩm"
sort="auto(tensp)" />
<listheader width="20%" label="Tên tắt"
sort="auto(tentat)" />
<listheader width="20%" label="Bộ phận"
sort="auto(dmPhongBan.tenpb)" />
<listheader width="10%" label="Đơn vị tính"
sort="auto(dmDonViTinh.ten)" />
<listheader width="20%" label="Loại sản phẩm"
sort="auto(idLoaisanpham)" />
</listhead>
<template name="model">
<listitem>
<listcell label="@load(each.masp)" />
<listcell label="@load(each.tensp)" />
<listcell label="@load(each.tentat)" />
<listcell label="@load(each.dmPhongBan.tenpb)" />
<listcell label="@load(each.dmDonViTinh.ten)" />
<listcell label="@load(each.idLoaisanpham)" />
</listitem>
</template>
</listbox>
</groupbox>
</window>
Hi, you can bind to Binding to Selected Index or selectedItem
Asked: 2013-09-18 09:26:42 +0800
Seen: 22 times
Last updated: Oct 07 '13
What you want to ask? Please exaplin the question what anyone understand from image and code? This is not the way to ask the any issue. Please follow standard .
sjoshi ( 2013-09-18 10:32:14 +0800 )edit