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

  • Home
  • SEARCH
  • 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 3990972
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:33:32+00:00 2026-05-20T06:33:32+00:00

Please see the sample code below. Initially the grid comes up with no sort

  • 0

Please see the sample code below.

  • Initially the grid comes up with no sort icon in any of the grid column headers – good.

  • Click on ‘Client’ column header to sort the grid.

  • Click on REFRESH button. It calls grid.trigger(‘reloadGrid’).

  • The grid is reloaded but sort icon on ‘Client’ header is still there. – not so good.

`

  $(function() {
     var mydata = [  
            {id:"1", name:"test",       amount:"200"},  
            {id:"2", name:"test2",      amount:"300"},  
            {id:"3", name:"F",          amount:"400"},  
            {id:"4", name:"test4",      amount:"200"},  
            {id:"5", name:"test5",      amount:"300"},  
            {id:"6", name:"test6",      amount:"400"},  
            {id:"7", name:"test7",      amount:"200"},  
            {id:"8", name:"test8",      amount:"300"},  
            {id:"9", name:"test9",      amount:"400"},  
            {id:"10",name:"test10",     amount:"500"},  
            {id:"11",name:"F",          amount:"500"},  
            {id:"12",name:"test11",     amount:"500"},  
            {id:"13", name:"test",      amount:"200"},  
            {id:"14", name:"O",         amount:"200"}  
 ];  
 jQuery("#list").jqGrid({           
        datatype: "local",  
        data: mydata,  
        width: 700,  
        loadComplete: function() {
            $(this).setGridParam({sortname: 'id'});
        },  
                    colNames:['Inv No','Client', 'Amount'],  
        colModel:[
            {name:'id',index:'id', width:65, sorttype:'int', searchoptions:{sopt:['eq','ne','lt','le','gt','ge']}},  
            {name:'name',index:'name', width:100, searchoptions:{dataUrl:'/api/domains/producttypedomain'}},  
            {name:'amount',index:'amount', sorttype:'int', width:80, align:"right"}
        ],  
        rowNum:100, 
        pager: '#pager',            
        height:'auto',  
        viewrecords: true,  
        rownumbers: true,  
        gridview : true,            
        caption:"Advanced Search Example"
    });
    jQuery("#list").jqGrid('navGrid','#pager',  
    {
        edit:false,add:false,del:false,search:true,refresh:true
    },  
    {}, // edit options
    {}, // add options
    {}, //del options
    {
        multipleSearch:true, overlay:false,  recreateFilter:true            
    } // search options
    );
});
$(function() {
    $('#refresh-btn').click(function() {
        jQuery("#list").trigger('reloadGrid');          
    });
});

`

  • 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-20T06:33:32+00:00Added an answer on May 20, 2026 at 6:33 am

    If you want that the sort icon will be not seen you can do this with

    $("span.s-ico",jQuery("#list").grid.hDiv).hide();
    

    Unsorted grid (sortname:'') is not the best choice in the most situations. So I recommend you to choose some column like ‘id’ for the data sorting. If you do want to have sorted data unsorted you have to set sortname:'' parameter before the grid reload. So the function executed on click of your ‘#refresh-btn’ button should be about the following

    $('#refresh-btn').click(function() {
        var myGrid = jQuery("#list");
        $("span.s-ico",myGrid[0].grid.hDiv).hide(); // hide sort icons
        myGrid.setGridParam({sortname: ''}).trigger('reloadGrid');
    });
    

    What you want to do in the loadComplete am am not sure. Changing of sortname parameter on the place is too late.

    You can see modified version of your code here. I change the order of some of the first items in the mydata array to show more clear that after the loading the data will be shown in the unsorted order.

    I recommend you to remove Reload button from the grid navigator bar or to add custom button with look like “Reload” button and do what you really want to have.

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

Sidebar

Related Questions

(please excuse that I didn't use aliases). I would like my query output to

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.