You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Brendan cheng <cc...@hotmail.com> on 2012/02/17 05:58:03 UTC

How to allow a ItemRenderer to take user input?

HI,
I built a ListView with customized ItemRenderer.  In the ItemRender, I have a TextInput field and I want to make it Editable and be able to take user input and change the list.
I set it TextIput component to Editable but it doesn't seem working.
Could you give me some direction?
I also want to take the user input and bring them to server side too.   I want to make the list dynamically synchronized with server data and user input.  is it too much to ask?
Brendan 		 	   		  

Re: How to allow a ItemRenderer to take user input?

Posted by Greg Brown <gk...@verizon.net>.
Yes, ListView also supports editors. The Kitchen Sink demo contains an example.

On Feb 20, 2012, at 5:27 AM, Sandro Martini <sa...@gmail.com> wrote:

> Hi,
> 
>> I built a ListView with customized ItemRenderer.  In the ItemRender, I have a TextInput field and I want to make it Editable and be able to take user input and change the list.
>> 
>> I set it TextIput component to Editable but it doesn't seem working.
> 
> Renderers are for display-only (they don't respond to mouse or
> keyboard interaction), they are only used to format and display the
> data.
> If you want to interact with the data then you need to implement an
> Editor, but I don't remember if it's possible on Lists (for sure with
> Tables yes).
> In any case, take a look for example a TableViewRowEditor,  which gets
> invoked (by default) when the user double clicks on a row.
> 
>> I also want to take the user input and bring them to server side too.
>> I want to make the list dynamically synchronized with server data and user input.  is it too much to ask?
> This is a different story and depends on what you have at server side,
> but usually if you exchange data in the json format many Pivot classes
> will handle it for you.
> You can look at some of our examples for interaction client/server,
> like Web Queries under tutorials (and the related Servlet,
> ExpenseServlet):
> http://pivot.apache.org/tutorials/
> and even a more real-world example, under "A Practical Example", for
> the "Stock Tracker" Application.
> All them are inside sources, and even in pivot-tutorials.war so you
> can try/debug in your local environment.
> 
> 
> Sandro

Re: How to allow a ItemRenderer to take user input?

Posted by Sandro Martini <sa...@gmail.com>.
Hi,

> I built a ListView with customized ItemRenderer.  In the ItemRender, I have a TextInput field and I want to make it Editable and be able to take user input and change the list.
>
> I set it TextIput component to Editable but it doesn't seem working.

Renderers are for display-only (they don't respond to mouse or
keyboard interaction), they are only used to format and display the
data.
If you want to interact with the data then you need to implement an
Editor, but I don't remember if it's possible on Lists (for sure with
Tables yes).
In any case, take a look for example a TableViewRowEditor,  which gets
invoked (by default) when the user double clicks on a row.

> I also want to take the user input and bring them to server side too.
> I want to make the list dynamically synchronized with server data and user input.  is it too much to ask?
This is a different story and depends on what you have at server side,
but usually if you exchange data in the json format many Pivot classes
will handle it for you.
You can look at some of our examples for interaction client/server,
like Web Queries under tutorials (and the related Servlet,
ExpenseServlet):
http://pivot.apache.org/tutorials/
and even a more real-world example, under "A Practical Example", for
the "Stock Tracker" Application.
All them are inside sources, and even in pivot-tutorials.war so you
can try/debug in your local environment.


Sandro