To set a different default order for your custom tables you need to modify a system file, so please do it carefully and make a backup first.
Let's say you have a title field in your custom table according to which you want to order your items by default. You would first open the \CMSModules\CustomTables\Controls\CustomTableDataList.ascx.cs file and find the HasItemOrderField method. Create a new similar method but for your custom field:
public bool HasTitleField
{
get
{
if (FormInfo != null)
{
return (FormInfo.GetFormField("title") != null);
}
else
{
// If form info is not available assume ItemOrder is not present to prevent further exceptions
return false;
}
}
}
Then, scroll down to where the Page_Load method ends and update the code to be similar as follows:
if (HasTitleField)
{
gridData.OrderBy = "title DESC";
}
else if (HasItemOrderField)
{
gridData.OrderBy = "ItemOrder ASC";
}
-jh-