Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 1 Monat
Letzter Beitrag:
vor 1 Jahr, 1 Monat
Beteiligte Autoren:
JP, Allard

[WB21] - Table row selection

Startbeitrag von JP am 01.07.2016 11:57

Hi All

WebDev Classic

Here is a strange one; I have a table on a page. Table is an Ajax table. It contains some rows. When I click on the table row I test what row I clicked on using TABLE_MyTable..Value. This code is in the Row Selection Browser code. But it always returns the PRIOR row that was selected and not the row I am currently selecting and which is actually highlighted on the table itself. What am I doing wrong?



selection based on browser code is not a good idea !!
better do it with servercode

maybe use: table selectplus()


von Allard - am 03.07.2016 14:37

Thanks for the reply.

The problem is that I need to submit the row selected to the server for processing and return a page to the user according to the row selected in the table. I think the following is my problem:

1) The table must be Ajax since it is populated according to prior conditions.

2) The table cannot call PageDisplay() in the "Ajax enabled server code" of the table - this is a WebDev restriction

3) So Fabrice suggested in the Table Browser Click code to call the click code of a hidden button using ExecuteProcess()

4) The hidden button non-Ajax server code then runs the PageDisplay() to display the appropriate page according to the table row selected.

The above works 9 out of 10 times. But ...

Putting the row selection test in the Table Row Selection Server code is fine except that the hidden button ExecuteProcess() must be in the (non-Ajax) Table Browser click code. It cannot run from the Ajax Table Server Row Selection.

And the problem is: the Table Row Selection Browser code executes first before the Table Row Selection Server code ...

So one ultimately is dependent on the Browser code having the right table row selected info.

Surely there is a way to solve this as I would imagine this is standard stuff?


von JP - am 04.07.2016 07:53

I think you want to display something based on a table value. Iam I right? Is the value of the table a representation of a database table value?

Because if it is you could just use the table as the pointer in the hreadseek() function.

Like this:

If hreadseekfirst( filename, id, yourtable) then

Pagedisplay( yourpage)

You can put this code in a buttun without ajax.


von Allard - am 08.07.2016 19:05

If I force the user to click a button with the PageDisplay() code it works 100% of the time. The button gets the correct table row and all good.

But if I try and make life easier for the user and use ExecuteProcess( BTN click code ) from the table browser click code in order to automatically, i.e. immediately, load the required page then this works only perhaps 9/10 times. When it fails it is because the table loses its table row value between selecting the row and the button click code firing.

I have noticed that the table also sometimes shows a loading animation over it after I click a row. I believe that this animation might be related to the problem.

The other problem with tables is that if the table is set to re-size / anchor with the browser height then when selecting a row under IE it flashes (disappears and re-appears) and under Edge it collapses to 1 pixel height. I think there is a bug in the table control under these circumstances.

The only sure solution is (1) don't allow the table to re-size with browser (solves flashing/collapsing issue), and (2) force the user to manually click a button to load a page (solves the table row losing its value).

von JP - am 09.07.2016 10:45
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.