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
Binding JSON to jqGrid
15/03/2014
14:22
Avatar
shah.abhilash
New Member
Members
Forum Posts: 2
Member Since:
15/03/2014
sp_UserOfflineSmall Offline

Hi All,

I am pretty new to jqGrid. Could someone guide me where i am going wrong in binding JSON to jqGrid?

Please note – i dont any control over web service so cannot modify json sent from web service.

Your help will be greatly appreciated.

JSON format:

[{"DepositType":0,"DepositId":0,"ReceiptNumber":"","CompanyId":2," Company":"Cosmos cooperative ","EmployeeId":1," EmployeeName ":"Abhilash Shah","MaturityDate":"2012-08-11T00:00:00","MaturityAmount":23311.0,"DateInvested":"2011-03-05T00:00:00","AmountInvested":20000.0,"ROI":10.25,"Term":16,","IsWithdrawn":false,"Purpose":"","Comments":""},{"DepositType":1,"DepositId":0,"ReceiptNumber":"9993","CompanyId":1,"Company":" Janta Sahakari Ltd","EmployeeId":3,"EmployeeName":"Sheela Shah","MaturityDate":"2013-06-11T00:00:00","MaturityAmount":253644.0,"DateInvested":"2012-06-11T00:00:00","AmountInvested":0.0,"ROI":0.0,"Term":12," ","IsWithdrawn":false,"Purpose":"","Comments":""},{"DepositType":0,"DepositId":0,"ReceiptNumber":"","CompanyId":1,"Company":"Solapur Janta Sahakari  Ltd","EmployeeId":3,"EmployeeName":"Sheela Shah","MaturityDate":"2013-08-30T00:00:00","MaturityAmount":125161.0,"DateInvested":"2011-05-30T00:00:00","AmountInvested":100000.0,"ROI":10.1,"Term":27, "IsWithdrawn":false,"Purpose":"","Comments":""},{"DepositType":0,"DepositId":0,"ReceiptNumber":"226575","CompanyId":6,"Company":" of Maharashtra","EmployeeId":3,"EmployeeName":"Sheela Shah","MaturityDate":"2013-10-05T00:00:00","MaturityAmount":100000.0,"DateInvested":"2012-10-05T00:00:00","AmountInvested":100000.0,"ROI":10.05,"Term":12, "IsWithdrawn":false,"Purpose":"","Comments":""}]

Below is the code snippet, simplified grid to contain only one column:

<script type="text/javascript">

        jQuery(document).ready(function () {

            jQuery("#depositGrid").jqGrid({

                url: 'http://localhost:50570/api/com&hellip;..s&#39;,

                datatype: 'json',

                type: "POST",

                colNames: ['Employee Name'],

                colModel: [

                { name: 'EmployeeName', index: ' EmployeeName ', align: "center", sortable: true }

                ],

                pager: jQuery('#pager'),

                rowNum: 10,

                rowList: [10, 20, 30],

                viewrecords: true,

                imgpath: 'themes/basic/images',

                caption: 'Company deposits'

            });

            jQuery("#depositGrid").navGrid('#Pager', {

                edit: true, add: true, del: true, search: true

            }).navButtonAdd('#Pager', {

                caption: "Add", buttonimg: "fullpath/row_add.gif", onClickButton: function () { alert("Adding Row") }, position: "last"

            }).navButtonAdd('#Pager', {

                caption: "Del", buttonimg: "fullpath/row_del.gif", onClickButton: function (id) { alert("Deleting Row: " + id) }, position: "last"

            });

        });

    </script>

    <div id="jqgrid">

        <table id="depositGrid"></table>

        <div id="Pager"></div>

    </div>

Regards,

Abhilash

16/03/2014
11:34
Avatar
shah.abhilash
New Member
Members
Forum Posts: 2
Member Since:
15/03/2014
sp_UserOfflineSmall Offline

Can anyone please help/guide where i am going wrong in binding JSON to JQGrid?

Regards,
Abhilash 

16/03/2014
12:04
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

You will need to configure the jsonReader.

Please look here

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
41 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