carriemjohnson
Programmer
I am trying to sort a column within a tree list by numerical value rather than by text value, but am having trouble with it within Java.
Here's my problem: I'm trying to sort some of my columns within my tree list by integer value instead of by text value. My problem comes within the onCompare(Object source, dxtlist.dxTreeList.OnCompareEvent e) method. I can access e.Compare but can not assign a value to the compare object. What can I assign a value to in the compare method in order to complete the comparison? Here is the code I'm working with:
private void tlGBStudents_onCompare(Object source, dxtlist.dxTreeList.OnCompareEvent e)
{
int i=0;
dxtlist.IdxTreeColumns cols = tlGBStudents.getColumns();
while (i < cols.getCount())
{
//csNone = 2
if(cols.getItem(i).getSorted() != 2)
{
return;
}
i++;
}
if (i < cols.getCount())
{
//tedSpinEdit = 6
if (cols.getItem(i).getColumnType() == 6)
{
if((Integer.valueOf(e.Node1.getStrings(i)).intValue() - Integer.valueOf(e.Node2.getStrings(i)).intValue())>0)
e.Compare = 1;
else
e.Compare = -1;
}
else
{
if (e.Node1.getStrings(i) > e.Node2.getStrings(i))
e.Compare = 1;
else
e.Compare = -1;
}
}
else
{
e.Compare = 0;
}
}
But I keep getting an error saying cannot assign value to Compare final variable. Thanks in advance for your help.
Carrie
Here's my problem: I'm trying to sort some of my columns within my tree list by integer value instead of by text value. My problem comes within the onCompare(Object source, dxtlist.dxTreeList.OnCompareEvent e) method. I can access e.Compare but can not assign a value to the compare object. What can I assign a value to in the compare method in order to complete the comparison? Here is the code I'm working with:
private void tlGBStudents_onCompare(Object source, dxtlist.dxTreeList.OnCompareEvent e)
{
int i=0;
dxtlist.IdxTreeColumns cols = tlGBStudents.getColumns();
while (i < cols.getCount())
{
//csNone = 2
if(cols.getItem(i).getSorted() != 2)
{
return;
}
i++;
}
if (i < cols.getCount())
{
//tedSpinEdit = 6
if (cols.getItem(i).getColumnType() == 6)
{
if((Integer.valueOf(e.Node1.getStrings(i)).intValue() - Integer.valueOf(e.Node2.getStrings(i)).intValue())>0)
e.Compare = 1;
else
e.Compare = -1;
}
else
{
if (e.Node1.getStrings(i) > e.Node2.getStrings(i))
e.Compare = 1;
else
e.Compare = -1;
}
}
else
{
e.Compare = 0;
}
}
But I keep getting an error saying cannot assign value to Compare final variable. Thanks in advance for your help.
Carrie