Easyui in this way get JSON embedded data to display JSON under JSON

Source: Internet
Author: User

The returned JSON data is given first.

{    "Total": "2",    "Rows": [        {            "id": "1",            "Name": "Zhang Fu Ban",            "Xiuhao": "2014009012",            "Exttend": {                "Sid": "1",                "Tid": "1",                "Tel": "18580711609",                "QQ": "564968550",                "Email": "[email protected]",                "SXDW": "Chongqing source Code Education Consulting Co., Ltd.",                "Sxdw_add": "Yongchuan District, Chongqing City",                "Jjlxrtel": "15922879092"            }        },        {            "id": "4",            "Name": "Test student name",            "Xiuhao": "2014009013",            "Exttend": {                "Sid": "4",                "Tid": "1",                "Tel": "1234567890",                "QQ": "12345",                "Email": "[email protected]",                "SXDW": "Internship Unit",                "Sxdw_add": "Unit Address",                "Jjlxrtel": "1234567890"            }        }    ]}

Yesterday encountered such a problem, in taking exttend inside the information, I used the following way:

{       field: ‘sxdw‘ ,       title: ‘实习单位‘ ,       width: 60,       formatter: function (value, rec) {           return rec.extend.sxdw;       }   },

This allows you to remove the value of the SXDW, but the account type, gender also shows the value of the internship unit address. I do not know where the problem is, search online, see the solution is to return REC.EXTEND.SXDW, so, but only return a field, so it is sure to return the correct value, but I want to return a number of fields. There is no way, just try it, I put field: ' Sxdw ' changed to field: ' Extend.sxdw, run again, unexpectedly got the result I want.

The following is the complete code:

1$ (' #student_list '). DataGrid ({2Fittrue,3Fitcolumns:true,4Rownumbers:true,5border:false,6Striped:true,7url:thinkphp[' MODULE ']+ '/student/getinfo/',8Toolbar: ' #student_tool ',9Rownumbers:true,//Show Line NumbersTenPagination:true,//Display the Pagination toolbar OnePageList: [15, 30, 45], APagenumber:1, -Pagesize:15, -Sortname: ' ID ', theSortOrder: ' ASC ',         - columns:[[ -              { -Field: ' ID ', +Title: ' Number ', -CheckBoxtrue, +width:100, A             },{ atField: ' Name ', -Title: ' Name ', -Sortable:true, -width:100, -             },{ -Field: ' Xiuhao ', inTitle: ' Study Number ', -Sortable:true, towidth:100, +             },{ -Field: ' Exttend.teacher ', theTitle: ' Instructor ', *Sortable:true, $width:100,Panax Notoginseng             },     -             { theField: ' Exttend.tel ', +Title: ' Phone ', ASortable:true, thewidth:100, +Formatterfunction(value, rec) { -                     returnrec.exttend[' Tel ']; $                 } $             },{ -Field: ' Exttend.qq ', -Title: ' QQ ', theWidth:80, -Formatterfunction(value, rec) {Wuyi                     returnrec.exttend[' QQ ']; the                 } -             },{ WuField: ' Exttend.email ', -Title: ' Email ', Aboutwidth:100, $Formatterfunction(value, row) { -                         returnRow.exttend.email; -                 } -             },{ AField: ' Exttend.sxdw ', +Title: ' Internship Unit ', thewidth:150, -Formatterfunction(value, row) { $                         returnROW.EXTTEND.SXDW; the                 } the             }, { theField: ' Exttend.sxdw_add ', theTitle: ' Internship Unit address ', -width:150, inFormatterfunction(value, row) { the                         returnRow.exttend.sxdw_add; the                 } About             },{ theField: ' Exttend.jjlxrtel ', theTitle: ' Emergency Contact phone ', thewidth:100, +Formatterfunction(value, row) { -                         returnRow.exttend.jjlxrtel; the                 }Bayi             },       the             ]]  the});
View Code

Easyui in this way get JSON embedded data to display JSON under JSON

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.