Sorting not working with formated numbers
Sorting not working with formated numbers
gntvls
Posts: 1Questions: 0Answers: 0
i have an issue, and cannot find any solution. I have a database, from there i selecting a lot of info, and than counting this data.
[code]
$table->td(
array($row->mailing_id, "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array($row->mailing_unique_id, "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array($row->mailing_name, "width=\"300\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array($row->campaign_id, "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array($row->segment_name, "width=\"100\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array($row->total_sent, "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@$viewSum[$row->mailing_unique_id], "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@number_format((@$viewSum[$row->mailing_unique_id] * 100)/$row->total_sent, 2, '.', '.').'%', "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(number_format(@$leadssum[$row->mailing_unique_id],0, '.', '.'), "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@number_format((@$leadssum[$row->mailing_unique_id]*100)/$row->total_sent,2, '.', '.').'%', "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@number_format((@$leadssum[$row->mailing_unique_id] * 100)/@$viewSum[$row->mailing_unique_id], 2, '.', '.').'%', "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(number_format(@$crossviewSum[$row->mailing_unique_id],0, '.', '.'), "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(number_format(@$crossleadsSum[$row->mailing_unique_id],0, '.', '.'), "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@number_format((@$crossleadsSum[$row->mailing_unique_id] * 100)/@$crossviewSum[$row->mailing_unique_id], 2, '.', '.').'%', "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@number_format(((@$leadssum[$row->mailing_unique_id]+@$crossleadsSum[$row->mailing_unique_id])/$row->total_sent)*100, 2, '.', '.').'%', "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\"")
);
[/code]
But when i displaying all the data in DataTables, sorting there is not right. Table thinks that 1.800 is less than 999, But it is thousands seperator. Data is going like this:
999
888
5.656
4.655
322
2.333
122
[code]
$table->td(
array($row->mailing_id, "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array($row->mailing_unique_id, "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array($row->mailing_name, "width=\"300\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array($row->campaign_id, "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array($row->segment_name, "width=\"100\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array($row->total_sent, "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@$viewSum[$row->mailing_unique_id], "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@number_format((@$viewSum[$row->mailing_unique_id] * 100)/$row->total_sent, 2, '.', '.').'%', "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(number_format(@$leadssum[$row->mailing_unique_id],0, '.', '.'), "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@number_format((@$leadssum[$row->mailing_unique_id]*100)/$row->total_sent,2, '.', '.').'%', "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@number_format((@$leadssum[$row->mailing_unique_id] * 100)/@$viewSum[$row->mailing_unique_id], 2, '.', '.').'%', "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(number_format(@$crossviewSum[$row->mailing_unique_id],0, '.', '.'), "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(number_format(@$crossleadsSum[$row->mailing_unique_id],0, '.', '.'), "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@number_format((@$crossleadsSum[$row->mailing_unique_id] * 100)/@$crossviewSum[$row->mailing_unique_id], 2, '.', '.').'%', "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\""),
array(@number_format(((@$leadssum[$row->mailing_unique_id]+@$crossleadsSum[$row->mailing_unique_id])/$row->total_sent)*100, 2, '.', '.').'%', "width=\"20\" style=\" border-bottom-width: 1px; border-bottom-style: solid;\"")
);
[/code]
But when i displaying all the data in DataTables, sorting there is not right. Table thinks that 1.800 is less than 999, But it is thousands seperator. Data is going like this:
999
888
5.656
4.655
322
2.333
122
This discussion has been closed.