:: Forum >>

Sorting files and directories

Hi,
I'm using the grid widget and I think is fantastic.
I use it to list and display files and folder (with the filesystem object in asp), but I have a problem.
When in my root folder there are some directories and I sort the items in my grid (e.g. by name) The folders are not listed at the top.

E.g.
I have the following items:
text1.txt: TEXT file
try1.pdf: PDF file
check1.doc: Word Document
mfolder: Folder

If I sort by name the items I get the following result:
check1.doc
mfolder
text1.txt
try1.pdf

How can I discriminate files and folders?

thanks
Seba
Monday, March 22, 2004
You can provide functions for both 'data/text' and 'data/value' properties. The first one will be used for display and the second for sorting.
Alex (ActiveWidgets)
Monday, March 22, 2004
Could you please show me azn example?
Seba
Tuesday, March 23, 2004
obj.setDataText(function(i, j){return myData[i][j]});

function mySortValues(i, j){
if (myData[i][j].match("ADR")) {
return "1" + myData[i][j]
}
else {
return "2" + myData[i][j];
}
}

obj.setDataValue(mySortValues);

In this example if you sort on company name - ADRs will come on top.
Alex (ActiveWidgets)
Tuesday, March 23, 2004
Great! Thanks so much.
Seba
Wednesday, March 24, 2004

This topic is archived.


Back to support forum

Forum search