[Vtigercrm-commits] [vtiger development] #4747: Enchancement Code Included: Make all fields sortable and remove having to add field name to sort_by array
vtiger development
vtiger-tickets at trac.vtiger.com
Tue Dec 18 15:26:27 EST 2007
#4747: Enchancement Code Included: Make all fields sortable and remove having to
add field name to sort_by array
------------------------------+---------------------------------------------
Reporter: brianlaughlin | Owner: developer
Type: enhancement | Status: new
Priority: unassigned | Milestone: 5.0.4
Component: vtigercrm | Version: 5.0.3
Keywords: sort by, sorting |
------------------------------+---------------------------------------------
There are only a few fields by default that allow you to click on the
header and sort. If you wanted to change that in the past you would have
to add the field name into the sort_by array.
Here is a simple fix that makes all fields sortable. Code contribution is
giving by Colin Wright from our team. Enjoy. I hope to see some iteration
of this include in a future build.
/include/utils/ListViewUtils.php --> Makes every column sortable in every
list view
Line 40 - added
// cw make all fields sortable on every list view
include_once('cw_utility.php');
$focus->sortby_fields = cwSortFields();
Function contained in cw_utility.php could be added inline - in which case
just change the include to
require_once('include/database/PearDatabase.php');
function cwSortFields() {
$sortby_fields = Array();
$query_fields = 'SELECT DISTINCT columnname FROM vtiger_field ORDER BY
columnname';
$result_fields = mysql_query($query_fields);
$fieldcnt = 0;
while($row_fields = mysql_fetch_array($result_fields)) {
$sortby_fields[$fieldcnt] = $row_fields["columnname"];
$fieldcnt = $fieldcnt + 1;
}
return $sortby_fields;
} // function end
http://forums.vtiger.com/viewtopic.php?p=58515#58515
Please reassign to the correct Milestone.
Sorry I don't know how to submit code better than this. We have lot more,
just don't know how to do it.
--
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/4747>
vtiger development <http://trac.vtiger.com/>
vtigerCRM
More information about the vtigercrm-commits
mailing list