PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WEBDEV 2024 → Incovenient when displaying records in AJAX tables
Incovenient when displaying records in AJAX tables
Débuté par Ezequiel Reverditto, 12 juin 2017 18:16 - 4 réponses
Membre enregistré
5 messages
Posté le 12 juin 2017 - 18:16
Good day developers.

I am having problems when displaying records in an AJAX table. I comment them is summary of what it is about: in my application, I find myself on a page executing two queries that receive the same parameter. (ID Acción). When opening the browser I have no problem running both queries and displaying the resulting records, as shown in the following image.






The code implemented below.
In 'Whenever Page cargarEvidencia is displayed (PHP Server)'

HExecuteQuery(QRY_LBL_datosAccion,hQueryDefault,PageParameter("IDACCION"))
HReadFirst(QRY_LBL_datosAccion)
FileToPage(cargarEvidencia,QRY_LBL_datosAccion)

STC_DATE3=DateToString(QRY_LBL_datosAccion.Fecha_Limite,"DD/MM/YYYY")
IF QRY_LBL_datosAccion.Presupuesto = 0 THEN
STC_NoName6 = "-----"
END

HExecuteQuery(QRY_TBL_listaEvidencias,hQueryDefault,PageParameter("IDACCION"))
TableDisplay(TABLE_D010_Evidencias)

Where with 'QRY_LBL_datosAccion' I am in charge of bringing and displaying the information in the STC controls and with the query 'QRY_TBL_listaEvidencias' I am in charge of displaying the information in a control table.

Now, this is the disadvantage: when for example I click on another row of the table or click on another button (for example, 'Subir Evidencia') I automatically delete the table data, as in the image I attached:





In the 'On Click' action of the 'Subir Evidencia' button, the only thing he did is:
CellDisplayDialog(CELL_NuevaEvidencia,cellCenter,True,70)

Do you have any idea what may be happening? I have tried many alternatives:

* Execute an embedded query in the table.
* Create a local procedure that encompasses the use of AJAXExecute, execute the query and show me the table.
* By implementing the FileToMemoryTable function.

And the behavior is the same, against any action taken in the context of the browser, the records in my table simply "disappear."


First of all thank you for taking the time to read this and hope you can help me.
Greetings!
Posté le 13 juin 2017 - 13:51
Hello Ezequiel,

it looks like your button is setup as a submit+NOT ajax button, which
refresh the page.

As you seem to be using only browser code in it, make sure that the
action in the button parameter is set to none/none.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 6/12/2017 à 10:16 AM, Ezequiel Reverditto a écrit :
Good day developers.

I am having problems when displaying records in an AJAX table. I comment
them is summary of what it is about: in my application, I find myself on
a page executing two queries that receive the same parameter. (ID
Acción). When opening the browser I have no problem running both queries
and displaying the resulting records, as shown in the following image.







The code implemented below.
In 'Whenever Page cargarEvidencia is displayed (PHP Server)'

HExecuteQuery(QRY_LBL_datosAccion,hQueryDefault,PageParameter("IDACCION"))
HReadFirst(QRY_LBL_datosAccion)
FileToPage(cargarEvidencia,QRY_LBL_datosAccion)

STC_DATE3=DateToString(QRY_LBL_datosAccion.Fecha_Limite,"DD/MM/YYYY")
IF QRY_LBL_datosAccion.Presupuesto = 0 THEN
STC_NoName6 = "-----"
END

HExecuteQuery(QRY_TBL_listaEvidencias,hQueryDefault,PageParameter("IDACCION"))

TableDisplay(TABLE_D010_Evidencias)

Where with 'QRY_LBL_datosAccion' I am in charge of bringing and
displaying the information in the STC controls and with the query
'QRY_TBL_listaEvidencias' I am in charge of displaying the information
in a control table.

Now, this is the disadvantage: when for example I click on another row
of the table or click on another button (for example, 'Subir Evidencia')
I automatically delete the table data, as in the image I attached:






In the 'On Click' action of the 'Subir Evidencia' button, the only thing
he did is:
CellDisplayDialog(CELL_NuevaEvidencia,cellCenter,True,70)

Do you have any idea what may be happening? I have tried many alternatives:

* Execute an embedded query in the table.
* Create a local procedure that encompasses the use of AJAXExecute,
execute the query and show me the table.
* By implementing the FileToMemoryTable function.

And the behavior is the same, against any action taken in the context of
the browser, the records in my table simply "disappear."


First of all thank you for taking the time to read this and hope you can
help me.
Greetings!
Membre enregistré
5 messages
Posté le 13 juin 2017 - 18:53
Hi Fabrice.

First of all, I appreciate your time.
Well, regarding this concern you were right. The solution is to configure the operations on the button controls and to enable the AJAX function so that this does not happen (I can do it with the buttons in which I have code only on the side of the browser).

Now, the question is this: when I choose to select a row in my AJAX table or I want to execute functions on the server side I still have the same drawback (the table is cleaned). This solved it in part by generating a query embedded in the table, but when on another previous page I want to show the evidence belonging to another action I still show the same list of records (so this does not help me).

You see, in the first image what looks like an image (in the 'Docs' column), is actually a button that it does is to use the File Display function to show me the file stored on the server and associated with that record.

This is the code:
sRuta is string

HReadSeekFirst(d010_evidencias,Id_Evidencia,TABLE_D010_Evidencias.COL_Id_Evidencia)
IF HFound(d010_evidencias) = True THEN
sRuta = QRY_TBL_listaEvidencias.Ruta_Archivo
//Info(sRuta)
FileDisplay(sRuta,"application/unknown")
ELSE
Info("No ingreso")
END

The "File Display" function is not compatible with AJAX, that's where it may be inconvenient. ¿Does anyone know of any other alternative to view files of different extensions in the browser?

In the second image that I uploaded, in the confirmation button, what I do is to store in my database the information of an evidence and also store in a local folder an evidence associated with that record that I upload (this evidence can be a file of Type .pdf, .docx, .png, etc). I have tried doing this with the AJAX mode enabled but I have problems uploading the document, so there is another problem.

Using these two buttons I continue to wipe the data in the table.
What dou you recommend? Use the table in "Browser mode"?
I hope it does not seem very annoying, I've been learning about WEBDEV for about six months and programming this project.

I am open to opinions.
Regards!
Posté le 13 juin 2017 - 23:05
Hi Ezequiel
the filedisplay would in any case REPLACE the current page, if yo don't
set another page as the destination...

So, what I would do :

in the table/button, BROWSER code, I would do an executeprocess of
another (hidden button)

That second button would have for destination another browser, and would
not be ajax enabled.

In that button server code, your filedisplay should work

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 6/13/2017 à 10:53 AM, Ezequiel Reverditto a écrit :
Hi Fabrice.

First of all, I appreciate your time.
Well, regarding this concern you were right. The solution is to
configure the operations on the button controls and to enable the AJAX
function so that this does not happen (I can do it with the buttons in
which I have code only on the side of the browser).

Now, the question is this: when I choose to select a row in my AJAX
table or I want to execute functions on the server side I still have the
same drawback (the table is cleaned). This solved it in part by
generating a query embedded in the table, but when on another previous
page I want to show the evidence belonging to another action I still
show the same list of records (so this does not help me).

You see, in the first image what looks like an image (in the 'Docs'
column), is actually a button that it does is to use the File Display
function to show me the file stored on the server and associated with
that record.

This is the code:
sRuta is string

HReadSeekFirst(d010_evidencias,Id_Evidencia,TABLE_D010_Evidencias.COL_Id_Evidencia)

IF HFound(d010_evidencias) = True THEN
sRuta = QRY_TBL_listaEvidencias.Ruta_Archivo
//Info(sRuta)
FileDisplay(sRuta,"application/unknown")
ELSE
Info("No ingreso")
END

The "File Display" function is not compatible with AJAX, that's where it
may be inconvenient. ¿Does anyone know of any other alternative to view
files of different extensions in the browser?

In the second image that I uploaded, in the confirmation button, what I
do is to store in my database the information of an evidence and also
store in a local folder an evidence associated with that record that I
upload (this evidence can be a file of Type .pdf, .docx, .png, etc). I
have tried doing this with the AJAX mode enabled but I have problems
uploading the document, so there is another problem.

Using these two buttons I continue to wipe the data in the table.
What dou you recommend? Use the table in "Browser mode"?
I hope it does not seem very annoying, I've been learning about WEBDEV
for about six months and programming this project.

I am open to opinions.
Regards!
Membre enregistré
5 messages
Posté le 16 juin 2017 - 16:38
Hi, Fabrice.

Again, thank you for your time. It is a more than interesting solution that you raised me, and I have tried to implement it but I have not had any luck regarding the behavior of the table.

I'll explain to you:

Outside the table I created a button (with the AJAX function disabled) where you pass the server code you had in the table. This button executes the "File Display" function in a new_browser.
sRuta is string

HReadSeekFirst(d010_evidencias,Id_Evidencia,TABLE_D010_Evidencias.COL_Id_Evidencia)

IF HFound(d010_evidencias) = True THEN
sRuta = QRY_TBL_listaEvidencias.Ruta_Archivo
FileDisplay(sRuta,"application/unknown")
ELSE
Info("No ingreso")
END

Now in the button that had in the column and in the table (row selection), in the browser section execute:
ExecuteProcess(AREA_Wrap.BTN_DisplayFile,trtClick)

This button in the table I have it configured "none" in both modes (operation and action) and 'Defined in the current page (Same location, current frame (_self))' as the target window.
  
I run the application, I can open the docuemento as it happened, but the table continues to clean.

Attached image as seen:




Will I have to use the ExecuteProcess but calling a local procedure?
I hope you can help me.

Greetings.