You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by ccp999 <cc...@hotmail.com> on 2012/10/28 13:24:14 UTC

Binding between a editing cell in TableView to an external TextInput

Hi,

How could I bind an editing cell of TableView with an external TextInput? 
This is an Excel like function where a formula bar is the external TextInput
and If I'm editing in a cell the formula also get updated.  I'm really don't
know how to achieve it thru NamespaceBinding.  

How to setup the source or target path, esp. for a cell of TableView?



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Binding-between-a-editing-cell-in-TableView-to-an-external-TextInput-tp4022194.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Binding between a editing cell in TableView to an external TextInput

Posted by ccp999 <cc...@hotmail.com>.
Thanks!  I use a flag to avoid the looping.



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Binding-between-a-editing-cell-in-TableView-to-an-external-TextInput-tp4022194p4022203.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Binding between a editing cell in TableView to an external TextInput

Posted by Roger Whitcomb <Ro...@rbwhitcomb.com>.
It shouldn't because the row editor listener is only active when you're actually editing. But you might have to either remove your master formula listener when it's not in edit mode or set a flag to not propagate changes when it's not being directly edited. 

HTH,
~Roger

Re: Binding between a editing cell in TableView to an external TextInput

Posted by ccp999 <cc...@hotmail.com>.
But this can not accepts two ways change and I think if I setup another
listener which will cause infinite looping, right?



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Binding-between-a-editing-cell-in-TableView-to-an-external-TextInput-tp4022194p4022199.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Binding between a editing cell in TableView to an external TextInput

Posted by Roger and Beth Whitcomb <Ro...@rbwhitcomb.com>.
I can't think of an automatic way at the moment.  But, you could 
definitely setup a TextInputContentListener in your row/cell editor and 
use the "textChanged" method to update the contents of the external 
TextInput.  The code would look something like this:

// During setup of your row editor
TextInput textInput = new TextInput();
textInput.getTextInputContentListeners().add(new 
TextInputContentListener.Adapter() {
     @Override
     public void textChanged(TextInput textInput) {
         formulaTextInput.setText(textInput.getText());
     }
});
rowEditor.getCellEditors().put(columnName, textInput);
...

HTH,
~Roger Whitcomb