This project is read-only.
4
Vote

Issues Sorting After Update

description

After applying the most current version of the User Directory Module the sort capabilities no longer function. I can no longer get the default view to sort on a field that I have defined in the "Sort Property" field in the settings of the module. Anybody have this issue or hopefully a solution?

comments

Sizzler wrote Jul 18, 2014 at 12:21 AM

I have that very same issue, ive added a profile propertyfield with datatype "integer" in order to make a sort order field, but it doesnt Work.

I cant even figure out what it actually use to sort the results, it sure isnt the firstname. :-/

sespringe wrote Jul 18, 2014 at 9:15 PM

The order it is defaulting to appears to be the order that the user was added to DNN as a user. I wish someone would respond to the issues section. I have tried everything to get a response.....

Sizzler wrote Aug 29, 2014 at 7:19 AM

It is indeed very annoying and in my case, i like to use the module for setting up "Contact us" pages as it works very well for that.

However in most cases the companies like to have a sort order based on the position of each given employee, so I just set up a hidden profile property that holds a numeric value and have the module sort by that.

But when sorting doesn't work, it all of a sudden turn from perfect to unusable....

However, the solution for me was to use an older version (01.02.00) and that one runs just fine under DNN 7.2.2 and sorting also works! :-)

wrote Sep 12, 2014 at 7:33 AM

TheRune wrote Nov 6, 2014 at 1:00 PM

I'm using a custom display on our current production server running 7.0.6, and I'm unable to upgrade to 7.3.3 without upgrading the user directory too, or it will fail with an error.

I tried to upgrade to version 1.3.1 and although the module does display the custom template, it's having the same issue as you guys describe with default sorting not working.

I tried to switch to the grid mode to take a look at the sorting code, and well here's a change I noticed in the code.

The old version of the module is simply using a javascript named "Sort('fieldname')", but in the new version it's named "Sort_dnn_ctrXXXX_View_searchText('fieldname')".

The sorting buttons actually does work in gridmode on standard fields. Copying the onclick function to custom templates will actually make the sort buttons work in the custom template too.

However the default sorting setting doesn't seem to work. In code implementing the view, everything seems to be changed. I really can't point at a line where it goes wrong (it's a bit too complex), but my best guess would be that the function is never called or perhaps called with the wrong name (i.e. Sort() instead of Sort_dnn_etc.()), but I didn't find any evidence of a call using the old code.

I hope the author finds and corrects this bug, but in the meantime, a workaround is to find the call to the proper field displayed in grid view, and then add that call in a custom seperate script deferred to load after the module is completely loaded. So add something like this:
<script>Sort_dnn_ctrXXXX_View_searchText('LastName')</script>
to the module footer, and the sorting works (just exchange the XXXX with the proper module ID and change the fieldname to what you need)

Hope this helps! :)

jcbarreau wrote Jun 19, 2015 at 6:28 PM

Hi,

Thanks Therune for you help;

I have tried to insert in the module footer, but no luck.

An other way. I have check the ID, but don't work.

Any other solution?

JC

wrote Oct 26, 2015 at 8:04 PM

wrote Nov 3, 2016 at 12:54 AM

mavjt wrote Nov 3, 2016 at 2:54 AM

I've found a simple codefix for this. The module copies a Base.vb into /App_Code/effority.UserDirectory. Open that and change the DefaultSortExpression method to:
 Get

                Dim direction As String = "ASC"
                Dim column As String = "UserId"

                Dim result As String = String.Empty

                If Not Settings(Consts.SORT_COLUMN) Is Nothing Then

                    If Not Settings(Consts.SORT_DIRECTION) Is Nothing Then

                        direction = CStr(Settings(Consts.SORT_DIRECTION))

                    End If

                    column = CleanColumnName(Me.ProfilePropertyCollectionDic(CInt(Settings(Consts.SORT_COLUMN))).PropertyName)

                    ' modified by jie
                    ' default UserId
                    'modified by mark chamberman
                    result = String.Format("{0} {1}", column, direction)

                End If

                Return result

            End Get