Sorting an edit grid form for fields lookup

please let a solution to sorting an edit grid form for the lookup fields. thank you