Query limit with skip and take with collection
@Chumper Hello, I have situation where more 30,000 records are there. I have been trying to collection but it gives all records and which is too much time processing to get the result. I want to limit on first call as a 0 to 10, and so on. Is there anyway that i can pass skip and take with collection. return Datatable::collection(Mymodel::all(array('id', 'zip', 'neighbourhood', 'city', 'province', 'created_at', 'updated_at')))
Any examples really appreciated. Please help me...
I would suggest to take the QueryEngine, it will only handle the needed amount of data. Is there a reason to use the CollectionEngine?
Hi
i'm using QueryEngine with take() but it still showing all row in my database?
i set sDom like this:
$tblOptions["sDom"]= '<"top">rt<"row"<"col-xs-12">>';
to remove all top and bottom.
is this cause my issue?
thank you!
Hi Chumper,
I checked bit its giving me an error on this line $this->originalBuilder = clone $builder;
it was something like $query_result = DB::table('tablename')->get()->take(10)->skip(10); return Datatable::query($query_result) ->make();
Do you have some sample example created on Queryengine, I tried to follow as per wiki but still facing issues?
To be honest the queryEngine was just a part i did as an bonus because it seems easy to implement. However as the usage grows there are much more errors than i can handle for the query part. The problem is that the datatable script also tries to set take and skip and therefore overrides your setting.
May this will be a feature i can tackle with datatable 3.x but i am not sure yet how to handle a very dynamic query in datatable where you can put prefilters on it and stuff like that.