Does anyone know how to refresh a grid on another form through a button? I mean when I add something, I want to see it reflected immediately on the other form.
Asked
Active
Viewed 2,945 times
0
-
2Is the form your are updating get opened from the other form? In that case you can capture the caller as Formrun caller = element.args().caller(); in init method. Then use caller.dataSource().research(true); on save button or modified method of fields to refresh caller. – Pradeep Muttikulangara Vasu Jan 20 '17 at 19:03
-
Hello again, thanks you for your time :D, form A have the grid, and when I press a button appers the form B whats its where I add data to the grid on the form A, so like I understand I put all on the form B `Formrun caller;` on the ClassDeclaration, `caller = element.args().caller();` on the Init method and `caller.dataSource().research(true);` on the add button, but sends me an error:: FormRun Object Not initialized... – Paul Noris Jan 20 '17 at 20:19
-
When you open form B from form A add the following line of code to initialize caller `args.caller(this)`. Also you should always check that object is not null `if (element.args() != null && element.args().caller() != null`. – Aliaksandr Maksimau Jan 20 '17 at 20:51
-
Is not working :s this is the code of the field with leave method `ret = super(); args = new args(); args.caller(this); args.parm( Field_OnFormA ); args.name( formstr( Form_B ) ); formRun = classFactory.formRunClass( Args ); formRun.init(); formrun.run(); formrun.wait(); return ret;` – Paul Noris Jan 20 '17 at 23:09
-
This is the code on the ClassDeclaration form_B `public class FormRun extends ObjectRun { Formrun caller; }` – Paul Noris Jan 20 '17 at 23:10
-
here is the code on the init : `super(); caller = element.args().caller(); if(!element.args().caller()) { throw error("Cant Run Directly"); } ` – Paul Noris Jan 20 '17 at 23:11
-
and here the button `super(); caller.dataSource().research(true);` – Paul Noris Jan 20 '17 at 23:11
-
1If your code is placed on control then use `args.caller(element)` instead of `args.caller(this)` http://stackoverflow.com/questions/4260403/this-vs-element-keyword-in-x – Aliaksandr Maksimau Jan 21 '17 at 16:51
1 Answers
4
If the form your are updating get opened from the other form, Then in updating form class declaration declare caller as Formrun caller;
Then in Init method initialize caller. caller = element.args().caller();
Then on save button clicked method after super, call this caller.dataSource().research(true)
;

Pradeep Muttikulangara Vasu
- 426
- 4
- 11