Re: Change column visibility or text based on combo selected value

2016-07-02 Thread Iamuser
Here is a test sample of how constructor for Form2 class looks like:
Form2 should update both childId and parentName, when child changes in
form1.
However, I only get the childId updated; parentName does not change.


public Form2(String id, IModel form1model) {
super(id,model);
Label lblChild = new Label("childId", new PropertyModel(form1model,
"Id"));
add(lblChild);
IModel modelParent = null;
if (form1model.getObject().getId() != null) {
Parent par =
SpringCtx.getAppDB(ParentDao.class).selectById(form1model.getObject().getId());
modelParent = new Model(par);
}
else
modelParent = new Model();
Label lblParentName = new Label("parentName", new
PropertyModel(modelParent, "Name"));
add(lblParentName);
}
Thank you for your help.

On Sun, Jul 3, 2016 at 12:06 AM, ganea iulia  wrote:

> Hello,
>
> In the form2 I need to display values from other models than in form1, but
> that are dependent on the values from the form1 model.
>
>
>
>
> On Tue, Jun 28, 2016 at 4:42 PM, Sven Meier [via Apache Wicket] <
> ml-node+s1842946n4674974...@n4.nabble.com> wrote:
>
>> After form submit the whole page will be re-rendered anyway, including
>> your form2. So you should not need to do anything additional here.
>>
>> Make sure your form2 is properly bound to your model objects:
>>
>> https://ci.apache.org/projects/wicket/guide/6.x/guide/modelsforms.html
>>
>> Have fun
>> Sven
>>
>> --
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://apache-wicket.1842946.n4.nabble.com/Change-column-visibility-or-text-based-on-combo-selected-value-tp4674943p4674974.html
>> To unsubscribe from Change column visibility or text based on combo
>> selected value, click here
>> 
>> .
>> NAML
>> 
>>
>
>


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Change-column-visibility-or-text-based-on-combo-selected-value-tp4674943p4675012.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Change column visibility or text based on combo selected value

2016-07-02 Thread Iamuser
Hello,

In the form2 I need to display values from other models than in form1, but
that are dependent on the values from the form1 model.




On Tue, Jun 28, 2016 at 4:42 PM, Sven Meier [via Apache Wicket] <
ml-node+s1842946n4674974...@n4.nabble.com> wrote:

> After form submit the whole page will be re-rendered anyway, including
> your form2. So you should not need to do anything additional here.
>
> Make sure your form2 is properly bound to your model objects:
>
> https://ci.apache.org/projects/wicket/guide/6.x/guide/modelsforms.html
>
> Have fun
> Sven
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-wicket.1842946.n4.nabble.com/Change-column-visibility-or-text-based-on-combo-selected-value-tp4674943p4674974.html
> To unsubscribe from Change column visibility or text based on combo
> selected value, click here
> 
> .
> NAML
> 
>


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Change-column-visibility-or-text-based-on-combo-selected-value-tp4674943p4675011.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Change column visibility or text based on combo selected value

2016-06-28 Thread Sven Meier
After form submit the whole page will be re-rendered anyway, including your
form2. So you should not need to do anything additional here.

Make sure your form2 is properly bound to your model objects:

https://ci.apache.org/projects/wicket/guide/6.x/guide/modelsforms.html

Have fun
Sven

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Change-column-visibility-or-text-based-on-combo-selected-value-tp4674943p4674974.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Change column visibility or text based on combo selected value

2016-06-28 Thread Iamuser
Hi,
Thank you for the help.
Now the requirement has changes, to update form2 after the submit of form1.
On form1:
SubmitLink lnk = new SubmitLink("saveSubmitLink") {
---
}
form1.add(lnk);

So, after the save of form1, I need to refresh the date on form2.

Could you please advise?

Thank you so much.

On Wed, Jun 22, 2016 at 3:37 PM, Sven Meier [via Apache Wicket] <
ml-node+s1842946n4674953...@n4.nabble.com> wrote:

> Hi,
>
> you're using a DropDownChoice? Then you have to use
> AjaxFormComponentUpdatingBehavior (note no "Choice" here).
>
> AjaxFormChoiceComponentUpdatingBehavior is to be used with Wicket input
> components which have multiple  tags in the resulting HTML.
>
> Have fun
> Sven
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-wicket.1842946.n4.nabble.com/Change-column-visibility-or-text-based-on-combo-selected-value-tp4674943p4674953.html
> To unsubscribe from Change column visibility or text based on combo
> selected value, click here
> 
> .
> NAML
> 
>


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Change-column-visibility-or-text-based-on-combo-selected-value-tp4674943p4674971.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Change column visibility or text based on combo selected value

2016-06-22 Thread Sven Meier
Hi,

you're using a DropDownChoice? Then you have to use
AjaxFormComponentUpdatingBehavior (note no "Choice" here).

AjaxFormChoiceComponentUpdatingBehavior is to be used with Wicket input
components which have multiple  tags in the resulting HTML.

Have fun
Sven

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Change-column-visibility-or-text-based-on-combo-selected-value-tp4674943p4674953.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Change column visibility or text based on combo selected value

2016-06-22 Thread Iamuser
Hi,
Thank you for the tip.

One issue that I'm facing now is that the listView is in one form on the
page (form1), and the table with the column is in another form on the same
page (form2).

=If in my form1 I call:

itemSelect.add(new AjaxFormChoiceComponentUpdatingBehavior() {
private static final long serialVersionUID = 8119676745783499408L;

@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(form2);
}
});


The following error is thrown:

Caused by: org.apache.wicket.WicketRuntimeException: Behavior
gui.proc.management.interference.Page1$Form1$5 can only be added to an
instance of a RadioChoice/CheckboxChoice/RadioGroup/CheckGroup

Thank you so much for your help.


On Mon, Jun 20, 2016 at 3:49 PM, Sven Meier [via Apache Wicket] <
ml-node+s1842946n4674945...@n4.nabble.com> wrote:

> Hi,
>
> you should use a column that always displays the correct text:
>
>   new AbstractColumn(Model.of("Text")) {
> public void populateItem(Item> cellItem, String
> componentId, IModel rowModel) {
>   cellItem.add(new Label(componentId), new
> AbstractReadOnlyModel() {
> public String getObject() {
>   return getColumnText();
> }
>   });
> }
>   }
>
> This way you just have to update the whole table via Ajax when your
> dropDown changes, e.g.
>
>   dropDown.add(new AjaxFormChoiceComponentUpdatingBehavior() {
> protected void onUpdate(AjaxRequestTarget target) {
>   target.add(table);
> }
>   });
>
> Hope this helps
> Sven
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-wicket.1842946.n4.nabble.com/Change-column-visibility-or-text-based-on-combo-selected-value-tp4674943p4674945.html
> To unsubscribe from Change column visibility or text based on combo
> selected value, click here
> 
> .
> NAML
> 
>


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Change-column-visibility-or-text-based-on-combo-selected-value-tp4674943p4674952.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Change column visibility or text based on combo selected value

2016-06-20 Thread Sven Meier
Hi,

you should use a column that always displays the correct text:

  new AbstractColumn(Model.of("Text")) {
public void populateItem(Item> cellItem, String
componentId, IModel rowModel) {
  cellItem.add(new Label(componentId), new
AbstractReadOnlyModel() {
public String getObject() {
  return getColumnText();
}
  });
}
  }

This way you just have to update the whole table via Ajax when your dropDown
changes, e.g.

  dropDown.add(new AjaxFormChoiceComponentUpdatingBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
  target.add(table);
}
  });

Hope this helps
Sven

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Change-column-visibility-or-text-based-on-combo-selected-value-tp4674943p4674945.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org