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