Deleing a row in a WebListBox

Hi All!

I have small app with a Weblistbox and ADD / DELETE buttons. On screen, the Weblistbox can show about 15 rows of data at a time. When I highlight one of the first 15 rows and press DELETE everything looks great and the list refreshes properly. But, if I delete a row that is farther down the list … like row 100… after deleting, the Weblistbox refreshes but returns to the top of the list and displays the first 15 rows again. Is this default behavior or am I missing something?

(Windows 11 pro - Xojo 2023r2)

Thanks!

Paul

What code do you use to delete the row? You may need to adjust it and use scroll to.

Hi Alberto!

Here’s the code:

If TaskList.SelectedRowIndex >= 0 Then
dim row As Integer
if TaskList.SelectedRowIndex = 0 then
row = TaskList.SelectedRowIndex + 1
else
row = TaskList.SelectedRowIndex - 1
end if

TaskList.RemoveRowAt(TaskList.SelectedRowIndex)

’ TaskList.SetFocus
’ TaskList.SelectedRowIndex = row
’ TaskList.Selected(row) = True

End If

The commented lines were for highlighting the next closest remaining row after a delete was performed… and that works again except for when I delete something like row 100.

Yes, I could try the scrollto but I was wondering… isn’t there a way to prevent the refresh of the screen or Weblistbox so the lines don’t appear to jump around?

Thanks!

Maybe a bug related to this Issue:
#71426 - Weblistbox scrolls to row 1 (refresh) when the webpage is resized

You can create a new Issue for @Ricardo_Cruz to review and see if it is related or not.

As a rule of thumb, if you can delete a row on a Desktop project and it behaves differently, at least the targets must match. Having a Desktop sample with the Web sample could be a good way to show the difference.

Yes @AlbertoD, it looks like the same issue causing #71426.

1 Like

Ahhh… Well, thank you for your reply @Ricardo_Cruz. Is this something that will be fixed in the next release? I suppose I could code a work-around for now but this is a pesky flaw. I use the weblistbox heavily in my UI and having it lose place or scrolling to the top is very annoying to users.

@Ricardo_Cruz, since you are now aware of this situation, do I need to log an official issue or anything?

Thanks! And thanks to you also @AlbertoD ! :slight_smile:

Paul

No @Paul_Murray1, no need to open a new issue, I’m pretty sure solving #71426 will also fix this one, but I’ve added a note in that case so I can double check it once it’s fixed.

Unfortunately I don’t think I’ll be able to fix this one in 2023r3 :slightly_frowning_face:, it will need a good amount of changes and we are already beta testing that release.

Hey @Ricardo_Cruz … does the Beta in testing include the new DataGrid for Desktop apps? I ask because I could potentially make my app a desktop app and just create a web portal later. Just thinking out loud…

The Grid control won’t be included in this release. You can check the Roadmap in this URL:

https://documentation.xojo.com/resources/roadmap.html

It’s in the fifth position at the moment.