Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I can change Default Sort Field ?

Status
Not open for further replies.

zerotol

Programmer
Nov 23, 2006
6
0
0
LV
LiveLink sort Name field by default, but I need change this one. All folder`s items must be sorted, for example, Modified field by default. Can I do this ?
 
Yes.Browseview.html may have to be amended accordingly.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
We have a similar kind of requirement.

For a specific folder (and all subfolders below) it, the sort order should be -name instead of name

I went to webnode_2_2_o\html\browseview.html and changed the following line
;nextUrl = Str.Format( "%1?func=ll&objid=%2&objAction=browse&sort=name", .Url() , data.nodeRec.DataID )

to

;nextUrl = Str.Format( "%1?func=ll&objid=%2&objAction=browse&sort=-name", .Url() , data.nodeRec.DataID )

I was wondering whether I can just reverse it globally and then worry about the folder and its subfolders.

But even the above change did not work.

I guess this is much more involved than just tweaking browseview.html.

Any help is hugely appreciated.
 
I think if you do not want to go into a lot of customizations and want to keep it simple you can still do it thru browseview.html.The actual sorting has already been done before it is passed to browseview.html and is done in the WebNode:_BrowseSort script.I just used a RecArray sort command to sort it again(bad because the user is waiting)all the ideas from _BrowseSort

Code:
See if you can locate in a 9.5 sp1 file browseview.html a line called
;for nodeRec in contents
You may want to try on a test server after backing up browseview.html Put these lines immedaiately above that in whitespace and hope it compliles I have builder so I can compile.I belive you can acheive sorting on whatever columns available and for the oscript inclined see the documentation for RecArray.

Code:
 ;echo("appnair try doing it here Commented after testing - sort ")
	//FIRST YOU HAVE TO OBTAIN THE INDEX OF THE COLUMN ON WHICH YOU ARE SORTING
	//OTHERWISE THE NEGATIVE SORT WILL NOT JIVE
	//;Integer	mySortCol = RecArray.IsColumn( contents, 'SUBTYPE' )
	//IF YOU WANTED A DESCENDING SORT
	//  ;Integer	mySortCol = -RecArray.IsColumn( contents, 'SUBTYPE' )
	
	;Integer	mySortCol = -RecArray.IsColumn( contents, 'MODIFYDATE' )
	   
	
	;RecArray.Sort( contents, mySortCol, TRUE )


Now my livelink sorts by subtype which I wanted always.




Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
Also this hardcoding might lead to losing other sorting option,so you might look at some flags to bypass it.If you look at the request object for the other sorting options I am sure you will find something that you can use.

so basically
Code:
case some request object that you can use
Default_load :additional params missing
then re-sort in web_lingo
else
let LL handle it

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
Nair,
Thanks a lot. I will try it.

It seems there is one more new requirement.

Only for a specific folder (which comes directly under enterprise folder) and for all subfolders below it (and sub-sub folders and so on), the sort order should be applicable.

I suppose this forces to touch Oscript side or can we do this in the browseview.html itself?

Madhu
 

The browseview.html variables does contain the nodes that it is returning,so shouldn't you be able able to flag off the code for whatever the business rule is ?


Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top