JSON parsing and DataGrid column repeat Problem __js

Source: Internet
Author: User

Just internship contact project, in the accumulation of experience, welcome to Exchange

Some time ago encountered JSON parsing and DataGrid column duplication problem, deliberately recorded, easy to view later.

JS Code:

function Search () {$ (' #gridList '). DataGrid ({Url:sy.contextPath + '/integratedsearchenterprise/findjointrade '), Method: ' Post ', Queryparams: $ ("#searchForm"). Serializejson (), Pagination:true, Striped:t
        Rue, Nowrap:false, Singleselect:false, Fit:true, Collapsible:true, Loading:true, Loadmsg:loadmsgs, Fitcolumns:true, Showheader:true, Pagenumber:1, pagesize:pagesizes , Pagelist:pagelists, Rownumbers:true, IDfield: ' id ', sortname: ' id ', Sortord ER: ' desc ', columns:[[{field: ' Basenumber ', title: ' Enterprise Number ', align: ' Left ', sortable: ' True ', Width: ' 5% '}, {F Ield: ' Cnname ', title: ' Industry name ', align: ' Left ', sortable: ' True ', Width: ' 22% '}, {field: ' Enterprisetrade ', title: ' Business Scope ',
	      	Align: ' left ', sortable: ' True ', Width: ' 5% ', formatter:function (value) {return value[0].scopename; }, {field: ' Opendate ', title: ' Opening date', align: ' Left ', sortable: ' True ', Width: ' 10% '}, {field: ' Businessstatus ', title: ' Operating state ', align: ' Left ', sortable: ' true ', 
                Width: ' 10% ', Formatter:function (val) {return businessstatusmap[val]; }, {field: ' Manageclass ', title: ' Karma Category ', align: ' Left ', sortable: ' True ', Width: ' 10% ', formatter:funct
                Ion (Val) {return enterprisetypemap[val]; }, {field: ' Enterprisetrade1 ', title: ' Managed Enterprise ', align: ' Left ', sortable: ' True ', Width: ' 23% ', formatter	
             : function (value,rowdata,rowindex) {return rowdata.enterprisetrade[0].trusteeid; }, {field: ' Enterprisetrade2 ', title: ' Governing Body ', align: ' Left ', sortable: ' True ', Width: ' 7% ', formatter:function (valu	
             E,rowdata,rowindex) {return enterprisemanagerence[rowdata.enterprisetrade[0].manageragence]; }, {field: ' id ', title: ' Operations ', align: ' left ', Width: ' 8% ', formatter:function (value, row, Index) {var v = ';
                    V + + viewbtn (row.id);
            return v;
        	}], Onloaderror:function () {$.messager.alert (Warningtitle, errormsgs, ' warning ');
        Closeprogress ();
		},onbeforeload:function (param) {startprogress ();
			}, Onloadsuccess:function (data) {Cleargrid (' #gridList '));
		Closeprogress (); 
}
    }); }
JSON value
{"Total": 5155, "Rows": [{"id": "{fffd1217-eac3-4f13-d0a9-5f1d759c3796}", "Cnname": "Shanghai Huangpu District passenger service rental service", "Enname": null, "abbreviation": null, "Organizationcode": null, "Economictype": "A", "Legalperson ":" Shuting "," Legalpersondocumenttype ": null," Legalpersondocumentnum ": null," PhoneNumber ": null," Fax " : null, "Businesslicense": null, "registereddistrict": null, "Registeredaddress": "No. 40 Lane 3rd, Mei Jia Jie, Huangpu District, Shanghai, China", "re Gisteredpostalcode ": null," Taxlicense ": null," Statisticslicense ": null," Complaintcall ": null," webs  ITE ": null," Isremove ": 0," addoperation ": null," Addtime ":" 2014-11-14 10:25:41 "," updateoperation ": NULL, "UpdateTime": null, "Manageclass": "2", "LicenseNumber": null, "Recordno": null, "Transitat Tachclass ": null," Parentbody ": null," parentvalidity ": null," Parentlicensenumber ": null," ParentName ": null," ParentscoPE ": null," Parentlssuer ": null," Nativeplace ": null," Foreignlicensenumber ": null," Opendate ":" 2005 -04-08 00:00:00 "," cancellationdate ": null," Basenumber ":" D006 "," Busbasenumber ": null," Businessstatu S ":" 206 "," alonedrive ":" Y "," Oldlicensenumber ": null," Oldrecordno ": null," Businesslicensedate ":" 2005-04-08 00:00:00 "," taxlicensedate ": null," REGISTERRMB ": null," email ": null," Legalpersonphone ": NULL, "REGISTERUSD": null, "Enterprisetrade": [{"id": "07cb914d8a4afcc1e0531629a8c05b8e", "Basici  D ":" {fffd1217-eac3-4f13-d0a9-5f1d759c3796} "," ScopeID ":" 21000 "," Scopecode ":" 21000 "," ScopeName ": "Rent", "tradestatus": "206", "registrationauthority": null, "approvalauthority": null, "manager Agence ":" 310000 "," managerdepartment ": null," Operatedistrict ":" 310101 "," operateaddress ":" Huangpu District, Shanghai city No. 40, Lane 3rd, Mei Jia Street "," OperatEpostalcode ": 200072," Dutyperson ": null," Dutypersontel ": null," Dutypersonmobile ": null," Du Typersonfax ": null," Dutypersonpostalcode ": null," Operateperiod ": null," Beginvaliddate ":" 2005-04-
      00:00:00 "," endvaliddate ": null," Recordoperateperiod ": null," recordbeginvaliddate ": null, "Recordendvaliddate": null, "nature": null, "Trusteeid": "{5bdb512d-e263-d47d-f75b-0002a83b5ed0}", "P Rofessional ": null," Professionlevel ": null," Specialtynum ": null," Ordinarynum ": null," Basen Umber ": null," Enterprisetype ": null," fixedassets ": null," currentassets ": null," Trainarea " : null, "trainroad": null, "Copperno": null, "Fsshop": null, "Cargotype": null, "Opendat  E ":" 2005-04-08 00:00:00 "," cancellationdate ": null," Cancellationreason ": null," Cancellationtype ": NULL, "AddoperatiOn ": null," Addtime ":" 2014-11-14 13:04:54 "," updateoperation ": null," UpdateTime ": null," ISR Emove ": 0," creditrate ": null," Remarks ": null," TradeID ":" 201 "}}]}

All the focus is to look at the format of JSON, curly braces, brackets, and the juxtaposition between them, all need to be clear before you can make a specific resolution.

and the column repeats in the DataGrid, a random column name is written, and then the corresponding method is invoked.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.