I have a table users
with header : Username, Name, Email, Type, Group, Status.
Right now, I set them to be orderedBy group
in my Controller Function.
I want to take this to a next level to improve my table UX.
- I want to orderedBy
username
if the user clicked on theusername
on my table header. - I want to orderedBy email if the user clicked on the email on my table header... so on ..
- Basically, orderedBy whatever the table header that the user click on.
If I can do this without refresh the page, that will be awesome. Do I need to know Ajax, or jQuery in order to get this done ? Is it possible to do this in php ? I am using Laravel 4.
Huge THANKS
to all users that contribute in this question.
UserController.php
public function index()
{
//get all the users from the database
$users = User::where('type','!=','Distributor')
->orderBy('group', 'asc')
->paginate(20);
// return the view and give it a title
return View::make('users.index')
->with('users',$users);
}
EDIT
My Table View
<table class="table table-hover">
@include('sub.index.tbody') // this line is just the detail of the table.
</table>