sorting own columns when using server side processing
sorting own columns when using server side processing
hey allan,
my problem is that I cant sort my own columns. I have 10 columns - 9 of them are server side and 1 depends on a server side column. This column can have the value "read" or "unread".
Can I sort this column somehow? If I try to sort this column it stucks at processing..
I tried to realise it this way:
in this part[code]while ( $aRow = mysql_fetch_array ( $rResult ) ) {[/code]
i give arow a new column with the value unread or read and give it to sOutput:
[code]
if ($messageDAO->isSupportUnreadByIDandUserID ( $aRow ['support_id'], $User->getUserID () ))
$aRow ['readOrUnread'] = "unread";
else
$aRow ['readOrUnread'] = "read";
$sOutput .= '"' . addslashes ( $aRow ['readOrUnread'] ) . '",';
[/code]
in the function fnColumnToField I let the value of aRow['readOrUnread'] return like this:
[code]
function fnColumnToField($i) {
..
else if ($i == 2)
return "readOrUnread";
..}
[/code]
can u tell me if my approach is wrong because i think i didnt understand the sense of fncolumntofield at all..
thank you in advance
TKing
my problem is that I cant sort my own columns. I have 10 columns - 9 of them are server side and 1 depends on a server side column. This column can have the value "read" or "unread".
Can I sort this column somehow? If I try to sort this column it stucks at processing..
I tried to realise it this way:
in this part[code]while ( $aRow = mysql_fetch_array ( $rResult ) ) {[/code]
i give arow a new column with the value unread or read and give it to sOutput:
[code]
if ($messageDAO->isSupportUnreadByIDandUserID ( $aRow ['support_id'], $User->getUserID () ))
$aRow ['readOrUnread'] = "unread";
else
$aRow ['readOrUnread'] = "read";
$sOutput .= '"' . addslashes ( $aRow ['readOrUnread'] ) . '",';
[/code]
in the function fnColumnToField I let the value of aRow['readOrUnread'] return like this:
[code]
function fnColumnToField($i) {
..
else if ($i == 2)
return "readOrUnread";
..}
[/code]
can u tell me if my approach is wrong because i think i didnt understand the sense of fncolumntofield at all..
thank you in advance
TKing
This discussion has been closed.
Replies
Using server side processing, you have to handle the sort in your server side code as well (in this case by applying an order by to your query), so unless the column readOrUnread was in your query, it wouldn't work.
Can you do an SQL JOIN to get the sorting correct or something - or is this informaiton simply not present in the SQL at all?
Allan