There are more than 10m data.
I takes a longtime for the list to first load.
How can i make sure that the 1k rows are chosen randomlt in the first load.
@willvin
Can you help me with this?
Which of the following codes should I place where?
“->take(1000);”
“->take(1000)->get();”
“->limit(1000);”
function index(Request $request, $fieldname = null , $fieldvalue = null){
$view = “pages.urunler.list”;
$query = Urunler::query();
$limit = $request->limit ?? 20;
if($request->search){
$search = trim($request->search);
Urunler::search($query, $search); // search table records
if ($request->ajax()) {
$view = “pages.urunler.search”; // use search component for dropdown search
}
}
$orderby = $request->orderby ?? “urunler.id”;
$ordertype = $request->ordertype ?? “desc”;
$query->orderBy($orderby, $ordertype);
if($fieldname){
$query->where($fieldname , $fieldvalue); //filter by a table field
}
$records = $query->paginate($limit, Urunler::listFields());
return $this->renderView($view, compact(“records”)); }
the data limit per pagination that this does
1000 instead of 20
Is that not what you want?
i want to limit total data on first load
Like this
Select * from urunler where 1 limit 1000
And that is the solution i provided for you above.
Hi @cemal, that is a 1000 record that has been fetched, when you click next, it fetches the next 1000 record, and so on. It shows you the total record in your database and the amount that has been fetched. Please note that it is working properly, thanks.