我从JSON获取模型数据。
我已经成功实现了searchContainer,但我想访问深层对象元素
<liferay-ui:search-container searchContainer="${searchRecordsContainer}" >
<!-- In order to get the total results and also to display no. of data -->
<liferay-ui:search-container-results total="<%=searchContainer.getTotal() %>" results="<%=searchContainer.getResults() %>" />
<!-- Display Row with First Name,Last Name,ScreenName and Description as columns -->
<liferay-ui:search-container-row className="com.demo.Records" >
<liferay-ui:search-container-column-text name="Record Id" property="recordId"/>
<liferay-ui:search-container-column-text name="Record Value" property="attributes.value('SOME_KEY')"/> //how to do this??
</liferay-ui:search-container-row>
<!-- Iterating the Results -->
<liferay-ui:search-iterator/>
</liferay-ui:search-container>
记录模型
public class Records {
private Attributes attributes;
private String recordId;
}
public class Attributes {
private List<Entry> entry;
public String getValue(String key) {
if (this.entry == null || this.entry.isEmpty()) {
return "";
}
for (Entry record : this.entry) {
if (record.getKey() != null && record.getKey().equalsIgnoreCase(key)) {
return record.getValue();
}
}
return "";
}
}
public class Entry {
private String key;
private String value;
}
So how do I call that specific method by passing some STRING value to get my desired value?
还有一点,I want to do some server side processing, when user clicks on nextPage or changes recordsPerPage or Sorting, how do I handle that?
任何例子都非常有用
答案 0 :(得分:1)
您可以拥有行的modelVar记录属性。
并使用它像record.getAttributes()。getValue(key)
此致