1. Jan Hoppe
  2. PowerBuilder
  3. Wednesday, 2 December 2020 12:00 PM UTC

My treeview datawindow collapses all levels when I apply a filter, is there an easy way to prevent this?

 

Jan Hoppe Accepted Answer Pending Moderation
  1. Friday, 4 December 2020 09:01 AM UTC
  2. PowerBuilder
  3. # 1

I am aware of the option Chris suggested, but it is a bit too rough for my taste, I need to expand only the items that was expanded before the filter.

What I am working on is this global function which works for one level :

global type f_filter_treeview from function_object
end type

forward prototypes
global subroutine f_filter_treeview (datawindow adw, string as_filter)
end prototypes

global subroutine f_filter_treeview (datawindow adw, string as_filter);long ll_rowid[], ll_row, ll_row2

for ll_row = 1 to adw.rowcount()
if adw.isexpanded( ll_row, 1) then ll_rowid[upperbound(ll_rowid) + 1] = adw.getrowidfromrow( ll_row)
next

adw.setredraw(false)
adw.setfilter(as_filter)
adw.filter()
for ll_row = 1 to upperbound(ll_rowid)
ll_row2 = adw.getrowfromrowid( ll_rowid[ll_row])
if ll_row2 > 0 then
adw.expand(ll_row2 , 1)
end if
next
adw.setredraw(true)

end subroutine

Comment
There are no comments made yet.
Govinda Lopez @Appeon Accepted Answer Pending Moderation
  1. Thursday, 3 December 2020 19:05 PM UTC
  2. PowerBuilder
  3. # 2

Hi Jan,

 

Besides what Chris has suggested, please also try to do a full build and optimize each library. See if this makes any difference.

 

 

Regards,

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 2 December 2020 16:46 PM UTC
  2. PowerBuilder
  3. # 3

Hi Jan;

   Have you tried ...

  • DC.SetReDraw ( FALSE )
  • DC.SetFilter ("xxxxx")
  • DC.Filter()
  • DC.ExpandAll ( )
  • DC.SetReDraw ( TRUE )

HTH

Regards ... Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.