Sunday, 15 July 2012

php - Datatables "Showing 0 to 0 of 0 entries" when there are multiple entries -



php - Datatables "Showing 0 to 0 of 0 entries" when there are multiple entries -

pagination doesn't work. see first page of results.

using bllim/datatables ~1.4 bundle laravel.

i've tracked downwards next code:

$items = item::select([ 'images.image', 'items.id', 'items.sku', db::raw("if(items.enabled, 'yes', 'no') enabled") ]) ->leftjoin('images', function ($j) { $j->on('items.id', '=', 'images.imageable_id') ->where('images.imageable_type', '=', 'item'); }) ->wherenull('items.deleted_at') ->groupby('items.id'); homecoming datatables::of($items)->make();

if remove leftjoin , remove images.image field pagination works correctly images don't show. image thumbnail shows correctly when maintain join, breaks pagination.

here image config on js side (if wondering...changing/removing not impact pagination):

{ atargets: [0], bsearchable: false, mdata: "image", mrender: function (data, type, full) { homecoming '<img src="' + full[0] + '" alt="thumbnail" class="img-thumbnail" />'; } }

what might problem query?

php laravel-4 pagination datatables

No comments:

Post a Comment