From 45c9e31baaa3099f77dedb615082820c5dd9b6b2 Mon Sep 17 00:00:00 2001 From: Kamil Tunkiewicz Date: Thu, 4 Sep 2014 11:26:21 +0200 Subject: [PATCH] Update README.md added info about set_row_class and set_row_data --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index dd1f8198..5909da77 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ Some things you should know: - The column identifiers are set by the returned array. - That means, for `posts.id` the relevant identifier is `id`, and for `owner.name as ownername` it is `ownername` - You can set the "index" column (http://datatables.net/reference/api/row().index()) using `set_index_column($name)` +- You can add class (DT_RowClass) to each row `using set_row_class($content)` function. +- You can add jquery's data (DT_RowData) to each row `using set_row_data($name,$content)` function. - You can add customized search filters for each column to override the default search functionality - You can call `make(true)` to return an array of objects instead of an array of arrays. (see Example 4) @@ -155,4 +157,16 @@ This returns a JSON array with data like below: } } +**Example 5: DT_RowID, DT_RowClass and DT_RowData** + +```php +$todo = ToDoList::select(array('todo.id','todo.name','todo.created_at','todo.status')); + +return Datatables::of($todo) + ->set_index_column('id') + ->set_row_class('@if($status=="done") success @endif') + ->set_row_data('created_at','{{$created_at}}') + ->make(); +``` + **License:** Licensed under the MIT License