Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 834505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:40:54+00:00 2026-05-15T04:40:54+00:00

I’m trying to get work this code: $(#list).jqGrid({ url: ’employers.php’, datatype: ‘json’, mtype: ‘POST’,

  • 0

I’m trying to get work this code:

$("#list").jqGrid({
                    url: 'employers.php',
                    datatype: 'json',
                    mtype: 'POST',
                    postData: {c : "", n: "", a: "", d: "", t: "", e: "", f: "", g: $('#selectSalary').value(), p: "", call: "report"},
                    colNames: ['ID','Name', 'Surname', 'Department', 'E-mail','Phone', 'Title in'],
                    colModel: [
                      { name:'rows.id',                index: 'id',   search:true, jsonmap: 'id', width: 50, align: 'left', sortable:true},
                      { name:'rows.name',                index: 'name',    jsonmap: 'name', width: 150, align: 'left'},
                      { name:'rows.surname',              index: 'surname',  jsonmap: 'surname', width: 240, align: 'left'},
                      { name:'rows.department',             index: 'department', jsonmap: 'department',  width: 330, align: 'left'},
                      { name:'rows.email',                 index: 'email',     jsonmap: 'email',width: 200, align: 'left'},
                      { name:'rows.phone',              index: 'phone',  jsonmap: 'phone', width: 170, align: 'left'},
                      { name:'rows.title', index: 'title', jsonmap: 'title',width: 120, align: 'left'}],

                    pager: '#pager',
                    rowNum: 8,
                    autowidth: true,
                    rowList: [10, 20],
                    sortname: 'id',
                    sortorder: 'asc',
                    viewrecords: true,
                    caption: "Employer's Salary",
                    jsonReader : {
                                    root: "rows",
                                    repeatitems: false
                                  },
                    height: 350,
                    width: 900
            });


$("#list").jqGrid('navGrid','#pager',{search:true, searchtext: "search",edit:false,add:false,del:false});

The HMTL I’m using:

<div id="report">
        <table id="list"></table>
        <div id="pager">
        </div>
<div>

And the PHP code:

$total_pages = 0;
$limit=10;
//Using QCubed, a PHP Framework and PDO
$count = Employers::CountAll();
if($count> 0)
$total_pages= ceil($count/$limit);
else
$total_pages=0;
$cnx = new PDO("mysql:host=localhost;dbname=appsms","root","");
$rows = array();
$strQuery="select id, name, surname, department, phone, email, title from Employer join Titles on " .
                           " (employers.title = Titles.id) and (employers.g = '"  .$this->g .
                           "') order by id;";

$stmt = $cnx->prepare($strQuery);
$stmt->execute(array("report"));
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$response->page = 1;
$response->total=  $total_pages;
$response->records = sizeof($rows);

$i=0;
foreach($rows as $result){
$response->rows[$i] = $result;
$i++;
}


echo json_encode($response);

It loads the query from PHP but the search option doesn’t work neither the sorting function on “cedula”‘s column. What I need to do?. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:40:55+00:00Added an answer on May 15, 2026 at 4:40 am

    I can see in your server code 'order by id' used indepand on the values of sidx and sord parameters (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:first_grid as an example of correct server code).

    The main role which you have to take in conseriration, if you use datatype: 'json' in the jqGrid additional parameters like sidx, sord, _search will be send to the server. The same works this the search option (filtering of data) see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:singe_searching for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 463k
  • Answers 463k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is more a workaround than a real solution but… May 16, 2026 at 12:43 am
  • Editorial Team
    Editorial Team added an answer Formatting of numbers appears to be locale-sensitive. This FAQ entry… May 16, 2026 at 12:43 am
  • Editorial Team
    Editorial Team added an answer SQLite supports compressed databases (readonly), and is ideal for a… May 16, 2026 at 12:43 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.