Setting CRUD list.html in PlayFramework

Hi I am trying to customize the list.html view for the CRUD section of an application to play.

My model is like this

I have an object with a relation to another object, for example:

@Entity
public class MyObjectA extends Model {

    @Required
    public String myObjectAName;

    ...

    @Required
    @ManyToOne
    public MyObjectB myObjectB;
}

Now in the list of .html that I am rewriting, I have this

<div id="crudListTable">
    #{crud.table fields:['myObjectB', 'myObjectAName'] /}
</div>

Now this code will display something like this, calling the following url http: // myplayapp / admin / myObjectAs in the browser

myObjectB __ myObjectAName

MyObjectB [1] __ Hello, this is the name for myObjectAName
MyObjectB [2] __ Hey, this is another name for myObjectAName

Note the use of the object name and object identifier in [] for my MyObjectB.

, myObjectBName MyObjectB , :

<div id="crudListTable">
    #{crud.table fields:['myObjectB.myObjectBName', 'myObjectAName'] /}
</div>

{module: crud}/app/views/tags/crud/table.html. > MissingPropertyException: : myObjectB.myObjectBName > : models.MyObjectA.

MyObjectB myObjectBName

, ?

+3
1

, fields ( MyObjectA) "myObjectB.myObjectBName" MyObjectA.

:

- toString() MyObjectB. , , MyObjectB, , .

:

public class MyObjectB extends Model {

  // ...

  @Override
  public String toString(() {
    return this.myObjectBName;
  }

}

, crud.custom.

:

#{crud.table fields:['myObjectB', 'myObjectAName']}
   #{crud.custom 'myObjectB'}
       ${object.myObjectB.myObjectBName}
   #{/crud.custom}
#{/crud.table}
+7

All Articles