Hi swaiba,
I already found a solution.
I already have a class ItemAdmin extending ModelAdmin.
I created a class ItemAdmin_CollectionController extending ModelAdmin_CollectionController class.
Then I override ModelAdmin_CollectionController class by setting $collection_controller_class under class ItemAdmin
==
public static $collection_controller_class ="ItemAdmin_CollectionController"
==
I overloaded getSearchQuery() >>
=====
function getSearchQuery( $searchCriteria ) {
$query = parent::getSearchQuery( $searchCriteria )->leftJoin( 'Category', 'Category.ID = Product.CategoryID' );
return $query->orderby( 'Category.Name, Product.Name ASC' );
}
=====
It worked!
There's also another way though. You can extend TableListField and set $resultsTableClassName to class name you created.
You can then overload function getQuery() like this >>
===
function getQuery() {
$this->customQuery->leftJoin( 'Category', 'Category.ID = Product.CategoryID');
$this->customQuery->orderby( 'Category.Name, Product.Name ASC' );
return parent::getQuery();
}
===
I hope this helps to everyone who will encounter this issue.