Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 4 Jahren, 7 Monaten
Letzter Beitrag:
vor 4 Jahren, 7 Monaten
Beteiligte Autoren:
Danny Lauwers, Fabrice Harari, Peter Holemans

[WB18] Update Table on page ?

Startbeitrag von Danny Lauwers am 11.09.2013 06:45

Hi,

I'm Still new to WebDev.I'm trying todo the following in a Classic WebProject (Webdev18)

I have a page with a tabel on in. On the page there is a global class containing the data. In the init of the table I load the class with data and display the data.
This is working correctly.

But I have a date edit field where the user can select an other date than the default "today". When the user has changed the date I call the AJAXExecute from the OnChange event of the date edit control.

AJAXExecute(RefreshTable,StringToDate(EDT_Date,"YYYYMMDD"))

The RefreshTable is the same function used to load and display the table in the init.
But nothing happens, the call is made because I can set a breakpoint and debug the code. New data is loaded, but on the screen the table stays the same ?

What I'm doing wrong here ?
So the general question: How can I update a table/combo/Otherfields that are linked with variables in a class via AJAX ?

Thanks
Danny

Antworten:

Hi Danny,

1) Is the table an Ajax table?
2) In your refresh code do you do a TableDisplay(TableName, taInit) assuming your table is directly bound to the class members?

If both are the case, this should work...

Cheers,

Peter

von Peter Holemans - am 11.09.2013 08:03
Hi Danny

your problem seems to come from the ajaxexecute. With this instruction, YOU are in charge of refreshing the screen when back in BROWSER code. It is a MANUAL ajax process that YOU are managing exactly the way you need...

It seems to me that instead you should do an executeprocess of a "refresh" button. The server code of this button would be in ajax mode, and everything you do in there in the table would then appear on the browser side automatically...

This is the BIG difference between ajaxexecute/ajaxexecuteAxynschronous and the ajax mode of controls...

Best regards

von Fabrice Harari - am 11.09.2013 11:46
Thanks for the info !

Ok I get the difference between calling Ajaxexecute and Ajax Mode of the controls.

I have created a clickable image next to the date edit control. When I press this the code of the click on the server is called and the table is refreshed, so refresh is working (when I press the button with the mouse).

I have put in the On change browser event of the date edit control the following code:

ExecuteProcess(MAP_Refresh,trtClick)
Info("Debug: Date CHanged")


The "MAP_Refresh" is a clickable image.
I see the debug message, so the code is run...only the table is not refreshed. When I press the clickable image, the table refreshes.
Do I call a wrong event of the control, The "Click" is not triggerd ?

I have this in the Click event (server):


Info("Debug: On Click in server")
PageToSource(PAGE_Test)
RefreshTable(gdViewDate)


Click event (Browser) is empty

When I change the date edit control and then press the refresh button manually, I don't get the date I have entered, but the previous one.

Where and when do I call PageToSource to update the global page variable gdViewDate ?
The EDT_Date control is linked to the variable gdViewDate.
gdViewDate (when empty) is set to TODAY in the init code of the control.
When I change the date the EDT_Date is changed (debugged it via Info(..)) but the variable gdViewDate is not changed ?

It is not (yet) clear to me how controls and linked variables are updated from server to browser and from Browser to server. Maybe you can explain this a bit.

Peter:
Where do I see that it is an Ajax table or not ? I guess I am using an Ajax table !
Yes I do call the DisplayTable to refresh the data in the table inself.

Thanks
Danny

von Danny Lauwers - am 11.09.2013 13:24
Hi Danny

as I was saying, you need to use a BUTTON... A clickable image doesn't have the SUBMIT option (it NEVER sends the value of the fields to the server, hence your out of date information on the server side)

best regards

von Fabrice Harari - am 11.09.2013 14:17
Thanks Fabrice,

It is now updating correctly.

When selecting a day (server event) I call


ExecuteProcess(BTN_RefreshTable,trtClick)



And the in the code of the button click


PageToSource(PAGE_TEST)

IF DateValid(gdViewDate) THEN
RefreshTable(gdViewDate)
END


I have some other issues, but I will start a new thread on the forum for that !

Thanks
Danny

von Danny Lauwers - am 13.09.2013 07:16
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.