SmartGWT: Selected Record from Listgrid bind to TextBox in another Window

426 views Asked by At

Im new to SmartGWT,

I have two Windows. Button1 in Window1 shows a Window2 containing a listgrid. On Press of Button2 in Window2 the selected record in listgrid must be shown in TextBox in Window1. What is the best approach for this? Any help is appreciated.

2

There are 2 answers

0
Alain BUFERNE On

You need to subclass Window for the two classe Window1 and Window2 You can define in Window1 setTextBox1 which will be public and which you can acces in Window2 if in it you have a reference on the instance of Window1 with a method setRefWindow1. So when you instanciate:

 Window1 w1 = new Window1();Window2 w2 = new Window2();w2.setRefWindow1(w1);
......

And in Window2 in the buttonCLick

refWindow1.setTextBox1(dataFromSelectedRecord);
0
RAS On

If you have Window1.Textbox accessible in Window2, then on click of Wondow2.Button2, you can get value from the selected Record of listgrid & set that value in Window1.Textbox.