Easyui dategrid field with formatter display child properties

Source: Internet
Author: User

Dategrid:

<body class= "Easyui-layout" data-options= "Fit:true,border:false" ><table id= "DG" class= "Easyui-datagrid" data-options= "Fit:true,border:false" url= "Book/listbookforuser" toolbar= "#toolbar" pagination= "true" rownumbers= " True "fitcolumns=" true "singleselect=" true "><thead><tr><th field=" bookId "width=" > Book id</ th><th field= "BookName" width= "> Title </th><th field=" BookType "width=" formatter= " Formatbooktype "> Book type </th><th field=" author "width=" "> Author </th><th field=" Callnumber "width= ">" ISBN </th><th field= "ISBN" width= ">isbn</th><th field=" publisher "Width=" > Publishers </th><th field= "publishyear" width= "> Publication year </th><th field=" series "Width=" > Series </th ><th field= "Language" width= "> Language </th><th field=" price "width=" > Prices </th><th Field = "page" width= "> Pages </th></tr></thead></table>

Here, book and BookType is a many-to-one relationship, back in the background json, BookType is a JSON object, to get BookType booktypename, can not be used directly booktype.booktypename. So add formatter to the field's BookType fields.



Val is the value of the field, which is booktype. Row is the line value. Note here to add an if null judgment, because I have books that have no type set, so that the type name is not found, resulting in no data for the entire date.






Easyui dategrid field with formatter display child properties

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.