3.0 beta 2

override sort <alex code> with rowtext adjustments problems..

hi!

i want to change the row indexing of the grid..
example.. set the 1st row index to 5..
i was able to do this with
obj.setRowText(function(i){return startingRow + i});

//grid..
[5][a]
[6][c]
[7][b]
.
.
.


.. but wenever i sort the grid via column header, the indexing are reshufffled..
//grid..
[6][c]
[7][b]
[5][a]
.
.
.
so i used the code posted by alex about the over ride sort..
$html .= " var mySort = function(src){\n";
$html .= " var i = src.getProperty('item/index');\n";
$html .= " var rows = this.getProperty('row/values');\n";
$html .=" rows.reverse();\n";
$html .= " this.setProperty('row/values', rows);\n";
$html .= " this.setProperty('sort/index', i);\n";
$html .= " this.setProperty('sort/direction', 'ascending');\n";
$html .= " this.refresh(); \n }\n";
$html .= " obj.setAction('columnSort', mySort);\n";
<never mind the $html..>
the sorting now works.. but it sorts according to the row index, not with the data under the column header..

problem is: how to manage the row indexing according to the my variable starting row and stil be able to sort the data acc to the clicked column header and stil retain the inc row index values set in the row header.. tnx..
=) hope to get some answers..

rach
September 9,
anyone... please..
rach
September 10,

obj.setRowText(function(i){
var iIndex = this.getSelectionProperty("index")
var iOrder = this.getRowProperty("order", iIndex)
return Number(iOrder) + startingRow
})
September 11,
hi!

where do i exactly place the code you gave.. is it in the sort function?..
thnx!
rach
September 12,
hi agen! i replace
obj.setRowText(function(i){return startingRow + i});
with your code.. am i right with that?.. and i took off the sort function.. the sorting is fine, however the indexing is not..

can u please give me a sample code.. i really cant figure this out..

anyway, thanks for the help. means a lot. :)
rach
September 12,
Sorry cut and paste error ....

This should work. I don't use row headers but the important piece is the order value to get the display row number. You should be able to drop this into the code where you create the grid (assuming Grid named grid). I tried it and it worked.

grid.setRowText(function(i){
var iOrder = grid.getRowProperty("order", i);
return Number(iOrder) + startingRow;
});

September 12,

it is now perfectly working! thanks a lot for your code. ;)
rach
September 13,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.