:: Forum >>

It's a bug?

I have various columns in a grid and some of that are string formated with Active.Formats.String. But when i try to short don't do in a logical order, that is alphabetically. But other columns formated with Active.Formats.Number short perfectly... It's for this reason why I think that it's a bug...

Why happens that? How can I solve it?
Wednesday, May 5, 2004
If it is not alphabetic order - its a bug. Can you post the example of the results?
Alex (ActiveWidgets)
Wednesday, May 5, 2004
This is one little example... I think that I don't have any errors... There are some parts that i don't use, like date format...


var myData = [
['Some','Description of Some','1000','30']
var obj = new Active.Controls.Grid;
var string = new Active.Formats.String;
var date = new Active.Formats.Date;
var number = new Active.Formats.Number;
var money = new Active.Formats.Number;
obj.setStyle("border", "1px solid");
var formats = [string,string,money,number];
obj.setColumnText(function(i){return myColumns[i]});
obj.setDataText(function(i, j){return formats[j].dataToText(myData[i][j])});
obj.setDataValue(function(i, j){return formats[j].dataToValue(myData[i][j])});
for (var col=0; col < (myColumns.length); col++) {
obj.getTemplate("column",col).setAttribute("title", function(){return this.getProperty("item/tooltip")});
obj.defineProperty("data/tooltip", function(i, col){if (myData[i][col]=="&nbsp;") { return ""; } else { return formats[col].dataToText(myData[i][col]);}});
obj.setAction("click", function(src){updata(formats[0].dataToText(myData[src.getRowProperty("index")][0]),formats[1].dataToText(myData[src.getRowProperty("index")][1]),formats[2].dataToValue(myData[src.getRowProperty("index")][2]),formats[3].dataToText(myData[src.getRowProperty("index")][3]))});
obj.setProperty("column/tooltip", function(i){return myColsTips[i]});
Thursday, May 6, 2004
If I sort on the first column - I get the following results:


which looks correct for me. If you need case-insensitive sort - convert all strings to upper-case:
    function(i, j){
        return formats[j].dataToValue(myData[i][j]).toUpperCase();
Alex (ActiveWidgets)
Thursday, May 6, 2004
That now works a little like i want... Now the order is correct... the proble was in the second column where the 'asdfas' value stay always at middle... look at that...

But works... thanks...
Friday, May 7, 2004
Just one more thing, if i do that the number and date cols crash when i try to short...
Friday, May 7, 2004
Sorry, you are right, toUpperCase should apply to strings only!
var string = new Active.Formats.String;
string.dataToValue = function(data){
return data.toUpperCase();

I should make it the default behavior anyway.
Alex (ActiveWidgets)
Sunday, May 9, 2004

This topic is archived.

Back to support forum

Forum search