PxPlus User Forum

Twitter Twitter Twitter

Author Topic: update dropdown [list] inside grid  (Read 382 times)

Zereliq

  • Member
  • **
  • Posts: 16
    • View Profile
update dropdown [list] inside grid
« on: August 16, 2022, 10:45:53 AM »
      Hi,I'm currently working on an app to register our companies worked hours online via Webster+
      but trying to get some list elements inside a grid to refresh in frontend does not seem to be working.

      What i want to have happen is the moment i change our "debiteur" column (which i do via a lookup table see image1)
      change the content of the dropdown in column "project", my console confirms changing the values but it does not
      show in frontend(image2)

      Is there a way to refresh just the list elements without refreshing the page? (this will make me lose entered values)



« Last Edit: August 16, 2022, 10:52:21 AM by Zereliq »

Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3701
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: update dropdown [list] inside grid
« Reply #1 on: August 16, 2022, 11:29:37 AM »
Have you tried %webster'Bind'Reload("name_of_list")?

This should reload the list definition including any drop box values.

Zereliq

  • Member
  • **
  • Posts: 16
    • View Profile
Re: update dropdown [list] inside grid
« Reply #2 on: August 17, 2022, 03:51:01 AM »
I might be doing something wrong so here's the code I'm using and what it returns:

Code: [Select]
col Source=project_code$ ttl="project" width=30 nosort][list project_code$][data rowsep=/ valsep=: text=(project_tbl$)][/list][/col]
Code: [Select]
%WEBSTER'BIND'RELOAD("project_code$")shows the following in console: ** Could not set: project_code$ == '<select id='**UPD**' name='project_code$'></select>' **

if I do a %WEBSTER'BIND'RELOAD on the name displayed in the live html code, (grid_eiguurf1-1-project_code$) then it doesnt return anything in console
so still only updates in the background.


Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3701
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: update dropdown [list] inside grid
« Reply #3 on: August 17, 2022, 08:35:58 AM »
You would provide the name of the Grid so the system can update it.

Technically there is no field called project_code$ since this is a column in a grid which makes its internal name is gridname-row-project_code$ but you cannot reload a specific col/cell as its not a valid variable name.

Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3701
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: update dropdown [list] inside grid
« Reply #4 on: August 17, 2022, 10:42:17 AM »
Something you might want to consider when using a grid with a list if values, when the page is generated that list of values will be included in the page for each line, so if your list of values has say 20 items and your grid has 100 lines, that becomes 2000 items that will be included in the HTML form.

You might find it easier to make the field a locked input with a query and set the background color to White using the class fill_white.  This will eliminate having the list items replicated on each row of the grid.  Just set the query to a Drop Query.  Other advantages using the drop query are that you can include multiple columns in the display which may assist the end user and the data is dynamic -- i.e. loaded when the query button is clicked.

Of course this assumes that the options can be sourced from a query.

Zereliq

  • Member
  • **
  • Posts: 16
    • View Profile
Re: update dropdown [list] inside grid
« Reply #5 on: August 23, 2022, 10:24:42 AM »
Hi Mike,

Thanks for the great suggestions, my college also helped out a bit and we ended up finding a sollution.
When it comes to the amount of data working with, we dont expect a lot more than 10 maybe 15 rows at
one point loaded on the page, therefor dont think it matters how many lists we're using on set page.