Pokud je v položkovém gridu vybraná některá z položek a zmáčkne se

"Smazat" u jiné položky, smaže se položka, na které tlačítko leží.

closes #159
Verze_1.0
František Přibyl 10 years ago
parent 13f35611fd
commit eaf37147dc

@ -126,6 +126,7 @@ public class RequirementForm extends FormViewModel<Requirement>
} }
@Command @Command
@NotifyChange({ "selItemIndex", "selectedItem" })
public void onFocusItem(@BindingParam("item") RequirementItem item, @BindingParam("ctrl") InputElement ctrl) public void onFocusItem(@BindingParam("item") RequirementItem item, @BindingParam("ctrl") InputElement ctrl)
{ {
this.selItemIndex = this.getDataBean().getItems().indexOf(item); this.selItemIndex = this.getDataBean().getItems().indexOf(item);
@ -148,13 +149,14 @@ public class RequirementForm extends FormViewModel<Requirement>
} }
@Command @Command
@NotifyChange({ "syncItems", "selItemIndex" }) @NotifyChange({ "syncItems", "selItemIndex", "selectedItem" })
public void removeItem(@BindingParam("form") SimpleForm form, @BindingParam("item") RequirementItem item) public void removeItem(@BindingParam("form") SimpleForm form, @BindingParam("item") RequirementItem item)
{ {
if (item != null) if (item != null)
{ {
this.getDataBean().getItems().remove(item); this.getDataBean().getItems().remove(item);
this.setSelItemIndex(-1); this.selItemIndex = -1;
this.selectedItem = null;
this.calcAndUpdateFormTotalPrice(form); this.calcAndUpdateFormTotalPrice(form);
} }
} }

@ -207,7 +207,7 @@
<button <button
image="~./zul/img/misc/drag-disallow.png" image="~./zul/img/misc/drag-disallow.png"
label="${labels.RemoveItem}" label="${labels.RemoveItem}"
onClick="@command('removeItem', item=each, form=fx, ctrl=self)" onClick="@command('removeItem', form=fx, item=each)"
sclass="nicebutton" /> sclass="nicebutton" />
</listcell> </listcell>
</listitem> </listitem>

Loading…
Cancel
Save