Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Not able to sort columns
12/05/2011
16:37
Avatar
santoshvk
Bangalore
Member
Members
Forum Posts: 5
Member Since:
11/05/2011
sp_UserOfflineSmall Offline

Hi,

In My Asp.net project

I am not able to sort on  the columns

function successFunction(jsondata) {
 
            var jsonObj = JSON.parse(jsondata.d);
 
            var stringObj = "{total:'',page:'',records:'',rows:[";
            for (var itr = 0; itr < jsonObj.length; itr++) {
                stringObj += "{ id:'" + itr + "',";
                stringObj += " cell:[";
                stringObj += "'" + jsonObj[itr].Empid + "',";
                stringObj += "'" + jsonObj[itr].Name + "',";
                stringObj += "'" + jsonObj[itr].Age + "'";
                stringObj += "]";
                if (itr == jsonObj.length - 1) {
                    stringObj += "}";
                }
                else {
                    stringObj += "},";
                }
            }
            stringObj += " ]}";
 
 
            var thegrid = jQuery("#JqGridBody")[0];
            thegrid.addJSONData(JSON.parse(stringObj));
 
        }
 
        function getProducts() {
            $.ajax({
                url: "Default.aspx/GetJsonDataFromService",
                data: "{}",
                dataType: "json",
                type: "POST",
                async: false,
                contentType: "application/json",
                success: successFunction,
                error: function (data) { alert(data); }
            });
        }
 
        function LoadJqGrid() {
 
            jQuery("#JqGridBody").jqGrid({
                datatype: getProducts,
                colNames: colHeader,
                colModel: colBody,
                rowNum: 10,
                rowList: [5, 10, 20, 50, 100],
                jsonReader:
                {
                    root: "rows",
                    page: "page",
                    total: "total",
                    records: "records",
                    repeatitems: true,
                    cell: "cell",
                    id: "id",
                    userdata: "userdata",
                    subgrid:
                    {
                        root: "rows",
                        repeatitems: true,
                        cell: "cell"
                    }
                },
                pager: '#JqGridPager',
                sortorder: "desc",
                multiselect: false,
                viewrecords: true,
                treeGrid: true,
                ExpandColumn: 'name',
                caption: "Json Data"
        })
        .filterToolbar()           
        .navGrid('#JqGridPager', { edit: true, add: true, del: true });
 
    }   
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
57 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information