Skip to content
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

JS grid load data above 5000 #1425

Open
PankajaRajput opened this issue Apr 19, 2023 · 0 comments
Open

JS grid load data above 5000 #1425

PankajaRajput opened this issue Apr 19, 2023 · 0 comments

Comments

@PankajaRajput
Copy link

notification.php

<script> $(function() { $('#grid_table').jsGrid({ width: "100%", height: "auto", selecting:true, filtering:true, inserting:false, editing: false, sorting: true, paging: true, autoload: true, pageSize: 15, pageButtonCount: 5, controller: { loadData: function(filter){ return $.ajax({ type: "GET", url: "fetch_data.php", data: filter }); }, }, fields: [ { name: "first_name", type: "text", title: "First Name", }, { name: "last_name", type: "text", title: "Last Name", }, { name: "client_phone", type: "text", title: "Client Phone", }, { name: "txtmessage", type: "text", title: "Message", width:"30%", }, { name: "direction", type: "text", title: "Direction", filtering: true, width:"10%", }, { name: "message_status", type: "text", title: "Status", filtering: true, width:"10%", }, { name: "created_at", type: "text", title: "Sent On", formatter: "date", width:"10%", }, { type: "control", modeSwitchButton: false,editButton:false, deleteButton:false,} ] }); }); </script>

fetch_data.php

$method = $_SERVER['REQUEST_METHOD'];

if($method == 'GET')
{
$data = array(
':first_name' => "%" . $_GET['first_name'] . "%",
':last_name' => "%" . $_GET['last_name'] . "%",
':client_phone' => "%" . $_GET['client_phone'] . "%",
':txtmessage' => "%" . $_GET['txtmessage'] . "%",
':direction' => "%" . $_GET['direction'] . "%",
':message_status' => "%" . $_GET['message_status'] . "%",
':created_at' => "%" . $_GET['created_at'] . "%",
);

$query = "select *,c.first_name,c.last_name,c.txtphone,p.project_name from crm_notifications as n left JOIN crm_clients as c ON c.client_id=n.client_id left JOIN crm_projects as p ON p.project_id=n.project_id WHERE c.first_name LIKE :first_name AND c.last_name LIKE :last_name AND n.client_phone LIKE :client_phone AND n.txtmessage LIKE :txtmessage AND n.direction LIKE :direction AND n.message_status LIKE :message_status AND n.created_at LIKE :created_at ORDER BY created_at DESC";

$statement = $connect->prepare($query);
$statement->execute($data);
$result = $statement->fetchAll();

foreach($result as $row)
{
if($row['message_status']=='Delivered'){
$ststusclass="text-success";
}
elseif($row['message_status']=='Failed' || $row['message_status']=='Invalid'){
$ststusclass="text-danger";
}
elseif ($row['message_status']=='Reply') {
$ststusclass="text-warning";
}
elseif ($row['message_status']=='Received') {
$ststusclass="text-primary";
}
else{
$ststusclass="";
}

$directionclass= ($row['direction']=='Incoming')?'text-warning':'text-success';

$direction= "".$row['direction']."";
$status = "".$row['message_status']."";

$output[] = array(
'first_name' => $row['first_name'],
'last_name' => $row['last_name'],
'client_phone' => $row['client_phone'],
'txtmessage' => $row['txtmessage'],
'direction' => $direction,
'message_status' => $status,
'created_at' => date("Y-m-d",strtotime($row['created_at'])),
);
}
//till here getting 4000 records but not proceeding with json encode

header("Content-Type: application/json");
echo json_encode($output);
}

'll return no data to jsgrid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant