Re: DataTable with input columns, refresh values shown in other columns

2016-11-10 Thread Sven Meier

Hi,

2)
perhaps you're updating the wrong row. Delay the search for the parent 
until you need it:


//change event
txt.add(new AjaxFormComponentUpdatingBehavior("change") {
  private static final long serialVersionUID = 1654345477970524731L;

  @Override
  protected void onUpdate(AjaxRequestTarget target) {
//this is how I get the row
MarkupContainer row = cellItem.findParent(Item.class);

getModelObject().setValue1(null);
getModelObject().setValue2(null);

target.add(row);
  }
});

Have fun
Sven



Am 10.11.2016 um 11:51 schrieb ganea iulia:

Hello,

2) Yes, the target.add(row) is on the callback from the modalWindow.
3) yes, I need to update the other values after user leaves the input, I
don't want immediate changes after each character change.
While in debug mode, I can see the change event being called, and the all
the values set to null, but the row is still not getting updated.


On Thu, Nov 10, 2016 at 12:08 PM, Sven Meier  wrote:


Hi,

2)
usually you would have a callback on your popup, that is called when the
it closes. This would be the time to update the edited row.

3)
the browser invokes the 'change' event only *after* leaving the input
field. You can listen for immediate changes with Wicket's
OnChangeAjaxBehavior - but updating the whole row while you're editing one
input inside of it will interfere with the user's input :/.

Hope this helps
Sven




Am 10.11.2016 um 10:55 schrieb ganea iulia:


Hello, thank you for the help.
It did solve some of the situations, but not all of them.
Here is where I still face issues.

In my table row, I have an input field and a icon near it. I insert text
into input field and press the icon (AjaxLink component).

1. If data exists in the db for that input value, the data is shown in
others columns - OK, this works now.
2. If data does not exist in the db for that input value, a popup window
opens allowing to insert the new values - NOK
 This does not work because  when coming back from the pop window the
row
is not refreshed with the new inserted values in the db.
3. on change event of the input, the data from the others row cells should
be emptied - NOK, this does not work either.

//this is how I get the row
MarkupContainer row = cellItem.findParent(Item.class);

//change event
txt.add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1654345477970524731L;

@Override
protected void onUpdate(AjaxRequestTarget target) {


getModelObject().setValue1(null);
getModelObject().setValue2(null);

target.add(row);
}

});


Thank you for your help


On Wed, Nov 9, 2016 at 12:43 PM, Sven Meier  wrote:

Hi,

I'm assuming you're using Ajax, so you should update the whole row after
your behavior/component has changed the field.

Each row item has to output a markup id, e.g. you can use a custom Item
subclass that calls #setOutputMarkupId(true):

  protected Item newRowItem(final String id, final int index, final
IModel model)
  {
  return new RowItem<>(id, index, model);
  }

This has the advantage, that you can update the row from wherever you are
inside the row:

  @Override
  protected void onUpdate(AjaxRequestTarget target) {
  RowItem row = findParent(RowItem.class);
  target.addComponent(row);
  }

Alternatively you can use Wicket event bubbling to notify the rowItem to
update itself.

Hope this helps
Sven



Am 09.11.2016 um 09:41 schrieb ganea iulia:

Hello,

I'm using wicket 7.5.
I have a DataTable, where one of the columns is an input textfield with
a
clickable icon near it. When providing data for the input field, and
clicking the icon, some validations are done, and the fields for other
columns should be updated accordingly.

However they are not updated at all.
Could you please advise how I can implement this?

Thank you.


-

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




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





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



Re: DataTable with input columns, refresh values shown in other columns

2016-11-10 Thread ganea iulia
Hello,

2) Yes, the target.add(row) is on the callback from the modalWindow.
3) yes, I need to update the other values after user leaves the input, I
don't want immediate changes after each character change.
While in debug mode, I can see the change event being called, and the all
the values set to null, but the row is still not getting updated.


On Thu, Nov 10, 2016 at 12:08 PM, Sven Meier  wrote:

> Hi,
>
> 2)
> usually you would have a callback on your popup, that is called when the
> it closes. This would be the time to update the edited row.
>
> 3)
> the browser invokes the 'change' event only *after* leaving the input
> field. You can listen for immediate changes with Wicket's
> OnChangeAjaxBehavior - but updating the whole row while you're editing one
> input inside of it will interfere with the user's input :/.
>
> Hope this helps
> Sven
>
>
>
>
> Am 10.11.2016 um 10:55 schrieb ganea iulia:
>
>> Hello, thank you for the help.
>> It did solve some of the situations, but not all of them.
>> Here is where I still face issues.
>>
>> In my table row, I have an input field and a icon near it. I insert text
>> into input field and press the icon (AjaxLink component).
>>
>> 1. If data exists in the db for that input value, the data is shown in
>> others columns - OK, this works now.
>> 2. If data does not exist in the db for that input value, a popup window
>> opens allowing to insert the new values - NOK
>> This does not work because  when coming back from the pop window the
>> row
>> is not refreshed with the new inserted values in the db.
>> 3. on change event of the input, the data from the others row cells should
>> be emptied - NOK, this does not work either.
>>
>> //this is how I get the row
>> MarkupContainer row = cellItem.findParent(Item.class);
>>
>> //change event
>> txt.add(new AjaxFormComponentUpdatingBehavior("change") {
>> private static final long serialVersionUID = 1654345477970524731L;
>>
>> @Override
>> protected void onUpdate(AjaxRequestTarget target) {
>>
>>
>> getModelObject().setValue1(null);
>> getModelObject().setValue2(null);
>>
>> target.add(row);
>> }
>>
>> });
>>
>>
>> Thank you for your help
>>
>>
>> On Wed, Nov 9, 2016 at 12:43 PM, Sven Meier  wrote:
>>
>> Hi,
>>>
>>> I'm assuming you're using Ajax, so you should update the whole row after
>>> your behavior/component has changed the field.
>>>
>>> Each row item has to output a markup id, e.g. you can use a custom Item
>>> subclass that calls #setOutputMarkupId(true):
>>>
>>>  protected Item newRowItem(final String id, final int index, final
>>> IModel model)
>>>  {
>>>  return new RowItem<>(id, index, model);
>>>  }
>>>
>>> This has the advantage, that you can update the row from wherever you are
>>> inside the row:
>>>
>>>  @Override
>>>  protected void onUpdate(AjaxRequestTarget target) {
>>>  RowItem row = findParent(RowItem.class);
>>>  target.addComponent(row);
>>>  }
>>>
>>> Alternatively you can use Wicket event bubbling to notify the rowItem to
>>> update itself.
>>>
>>> Hope this helps
>>> Sven
>>>
>>>
>>>
>>> Am 09.11.2016 um 09:41 schrieb ganea iulia:
>>>
>>> Hello,

 I'm using wicket 7.5.
 I have a DataTable, where one of the columns is an input textfield with
 a
 clickable icon near it. When providing data for the input field, and
 clicking the icon, some validations are done, and the fields for other
 columns should be updated accordingly.

 However they are not updated at all.
 Could you please advise how I can implement this?

 Thank you.


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


Re: DataTable with input columns, refresh values shown in other columns

2016-11-10 Thread Sven Meier

Hi,

2)
usually you would have a callback on your popup, that is called when the 
it closes. This would be the time to update the edited row.


3)
the browser invokes the 'change' event only *after* leaving the input 
field. You can listen for immediate changes with Wicket's 
OnChangeAjaxBehavior - but updating the whole row while you're editing 
one input inside of it will interfere with the user's input :/.


Hope this helps
Sven



Am 10.11.2016 um 10:55 schrieb ganea iulia:

Hello, thank you for the help.
It did solve some of the situations, but not all of them.
Here is where I still face issues.

In my table row, I have an input field and a icon near it. I insert text
into input field and press the icon (AjaxLink component).

1. If data exists in the db for that input value, the data is shown in
others columns - OK, this works now.
2. If data does not exist in the db for that input value, a popup window
opens allowing to insert the new values - NOK
This does not work because  when coming back from the pop window the row
is not refreshed with the new inserted values in the db.
3. on change event of the input, the data from the others row cells should
be emptied - NOK, this does not work either.

//this is how I get the row
MarkupContainer row = cellItem.findParent(Item.class);

//change event
txt.add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1654345477970524731L;

@Override
protected void onUpdate(AjaxRequestTarget target) {


getModelObject().setValue1(null);
getModelObject().setValue2(null);

target.add(row);
}

});


Thank you for your help


On Wed, Nov 9, 2016 at 12:43 PM, Sven Meier  wrote:


Hi,

I'm assuming you're using Ajax, so you should update the whole row after
your behavior/component has changed the field.

Each row item has to output a markup id, e.g. you can use a custom Item
subclass that calls #setOutputMarkupId(true):

 protected Item newRowItem(final String id, final int index, final
IModel model)
 {
 return new RowItem<>(id, index, model);
 }

This has the advantage, that you can update the row from wherever you are
inside the row:

 @Override
 protected void onUpdate(AjaxRequestTarget target) {
 RowItem row = findParent(RowItem.class);
 target.addComponent(row);
 }

Alternatively you can use Wicket event bubbling to notify the rowItem to
update itself.

Hope this helps
Sven



Am 09.11.2016 um 09:41 schrieb ganea iulia:


Hello,

I'm using wicket 7.5.
I have a DataTable, where one of the columns is an input textfield with a
clickable icon near it. When providing data for the input field, and
clicking the icon, some validations are done, and the fields for other
columns should be updated accordingly.

However they are not updated at all.
Could you please advise how I can implement this?

Thank you.



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





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



Re: DataTable with input columns, refresh values shown in other columns

2016-11-10 Thread ganea iulia
Hello, thank you for the help.
It did solve some of the situations, but not all of them.
Here is where I still face issues.

In my table row, I have an input field and a icon near it. I insert text
into input field and press the icon (AjaxLink component).

1. If data exists in the db for that input value, the data is shown in
others columns - OK, this works now.
2. If data does not exist in the db for that input value, a popup window
opens allowing to insert the new values - NOK
   This does not work because  when coming back from the pop window the row
is not refreshed with the new inserted values in the db.
3. on change event of the input, the data from the others row cells should
be emptied - NOK, this does not work either.

//this is how I get the row
MarkupContainer row = cellItem.findParent(Item.class);

//change event
txt.add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1654345477970524731L;

@Override
protected void onUpdate(AjaxRequestTarget target) {


getModelObject().setValue1(null);
getModelObject().setValue2(null);

target.add(row);
}

});


Thank you for your help


On Wed, Nov 9, 2016 at 12:43 PM, Sven Meier  wrote:

> Hi,
>
> I'm assuming you're using Ajax, so you should update the whole row after
> your behavior/component has changed the field.
>
> Each row item has to output a markup id, e.g. you can use a custom Item
> subclass that calls #setOutputMarkupId(true):
>
> protected Item newRowItem(final String id, final int index, final
> IModel model)
> {
> return new RowItem<>(id, index, model);
> }
>
> This has the advantage, that you can update the row from wherever you are
> inside the row:
>
> @Override
> protected void onUpdate(AjaxRequestTarget target) {
> RowItem row = findParent(RowItem.class);
> target.addComponent(row);
> }
>
> Alternatively you can use Wicket event bubbling to notify the rowItem to
> update itself.
>
> Hope this helps
> Sven
>
>
>
> Am 09.11.2016 um 09:41 schrieb ganea iulia:
>
>> Hello,
>>
>> I'm using wicket 7.5.
>> I have a DataTable, where one of the columns is an input textfield with a
>> clickable icon near it. When providing data for the input field, and
>> clicking the icon, some validations are done, and the fields for other
>> columns should be updated accordingly.
>>
>> However they are not updated at all.
>> Could you please advise how I can implement this?
>>
>> Thank you.
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: DataTable with input columns, refresh values shown in other columns

2016-11-09 Thread Sven Meier

Hi,

I'm assuming you're using Ajax, so you should update the whole row after 
your behavior/component has changed the field.


Each row item has to output a markup id, e.g. you can use a custom Item 
subclass that calls #setOutputMarkupId(true):


protected Item newRowItem(final String id, final int index, 
final IModel model)

{
return new RowItem<>(id, index, model);
}

This has the advantage, that you can update the row from wherever you 
are inside the row:


@Override
protected void onUpdate(AjaxRequestTarget target) {
RowItem row = findParent(RowItem.class);
target.addComponent(row);
}

Alternatively you can use Wicket event bubbling to notify the rowItem to 
update itself.


Hope this helps
Sven


Am 09.11.2016 um 09:41 schrieb ganea iulia:

Hello,

I'm using wicket 7.5.
I have a DataTable, where one of the columns is an input textfield with a
clickable icon near it. When providing data for the input field, and
clicking the icon, some validations are done, and the fields for other
columns should be updated accordingly.

However they are not updated at all.
Could you please advise how I can implement this?

Thank you.




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



DataTable with input columns, refresh values shown in other columns

2016-11-09 Thread ganea iulia
Hello,

I'm using wicket 7.5.
I have a DataTable, where one of the columns is an input textfield with a
clickable icon near it. When providing data for the input field, and
clicking the icon, some validations are done, and the fields for other
columns should be updated accordingly.

However they are not updated at all.
Could you please advise how I can implement this?

Thank you.