-
-
Notifications
You must be signed in to change notification settings - Fork 855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search #12
Comments
I think this was due to the number of columns did not match the |
Everything shows fine. It's just that the search shows that error. here"s my view:
I'll run a check without the language translations. However, I don't think that is an issue.... |
I see. Since your using {data: 'actions', orderable: false, searchable: false} |
BTW: you can also use firebug / inspect element on Chrome to better trace the error. |
I was removing the ID field
I use the ID field for the actions (view, edit, delete). I still need to stress test. |
More not so good news
Will also cause a search error. This is ok
@ stress test |
Thanks will try to do more testing too with joins on my free time. I think the original version (bllim) were also having this issues. But so far on my projects it does works well. |
The search errors are with the parsing of the datatables and not on the laravel side. I can echo out the api call with no problems. Could you post some of your code? |
I really didn't like the blim version and chumper's version isn't as simple as your's. IF you changed the name of this package I bet a lot of people would look at it. |
Here's a sample code on my project with joins using Laravel 4: public function getDataTable($id=0)
{
$models = $this->model->select('sales.*','carriers.name as carrier',
'leads.first_name','leads.last_name', 'sale_statuses.status','products.name as product')
->leftJoin('leads','leads.id','=','sales.lead_id')
->leftJoin('sale_statuses','sale_statuses.id','=','sales.status_id')
->leftJoin('carriers','carriers.id','=','sales.carrier_id')
->leftJoin('products','products.id','=','sales.product_id');
// display sales for specific lead
if ($id) $models->where('lead_id', $id);
return Datatables::of($models)->make(true);
} salesTable = $('#sales-table').DataTable({
"processing": true,
"serverSide": true,
"ajax": "{{ url('admin/sales/data-table/'. $lead->id) }}",
"columns": [
{ "data": function(d){
return '<input type="checkbox" name="id[]" value="'+ d.id +'" />';
}, "orderable": false, "searchable":false, "name":"sales.id" },
{ "data": function(d){
return d.lead_id ? '<a href="{{ url("admin/leads/show") }}/' + d.lead_id + '#sales">' + d.first_name + ' ' + d.last_name + '</a>' : '';
}, "name": 'leads.first_name', "visible": {{{ $lead->id ? 'false':'true' }}}
},
{ "data": function(d){
return '<a href="{{ url("admin/sales/edit") }}/' + d.id + '">' + d.product + '</a>';
}, "name": 'products.name'
},
{ "data": "appDateFormatted", "name":"sales.application_at" },
{ "data": "carrier", "name":"carriers.name" },
{ "data": "amount", "name":"sales.amount" },
{ "data": "application_no", "name":"sales.application_no" },
{ "data": "status", "name":"sale_statuses.status" }
],
"order": [[3, 'desc']]
}) Thanks for the appreciation for this package. I originally fork this version because bllim's version is not working on oracle and since Laravel does not support Oracle too, I was hesitant to make PR to bllim to support oracle so I decided to create my own and specifically target Oracle users. But this project does work on other database too just as the original fork. |
Thanks! OK, what I'm noticing as errors so far.
Will display but will cause error on search: because full_name is not a column name. Concating at the view level:
displays no problem and will search on last_name with no issues. However! this method will not let you search on first_name. So close ... 😭 If you build your actions in the controller, like I did above, make sure to add the orderable and searchable values in the js: id
I should start a new issue for this but
Why is "carriers.name" under the "name" option and not the "data" js option? thanks~!~ |
For If you want to search for {data: 'first_nam'`, name: 'first_name', visible: false} |
That works! note:
|
@mastrip2 Just nailed it; changed my initialization as follow. var tableIndex=$('#tableIndex').DataTable({ ], Thank you fam |
Search is giving me this error
here is my view call:
Everything is running good!
The text was updated successfully, but these errors were encountered: