Home » Eclipse Projects » Eclipse Scout » Scout Mars M4 and SearchForms
Scout Mars M4 and SearchForms [message #1536298] |
Tue, 30 December 2014 05:59 |
|
Hello,
right now I'm trying to implement a search form for one of my entities.
Generating and and opening the search form works out of the box. It's opened with the according tablepage.
But when looking at the MiniCRM tutorial the search criterias are handled in
@Override
protected Object[][] execLoadTableData(SearchFilter filter) throws ProcessingException {
CompanySearchFormData formData = (CompanySearchFormData) filter.getFormData();
if(formData == null) {
formData = new CompanySearchFormData();
}
return SERVICES.getService(IStandardOutlineService.class).getCompanyTableData(formData);
}
and then in the ServicOutline
Implementation:
public Object[][] getCompanyTableData(CompanySearchFormData formData) throws ProcessingException {
StringBuilder statement = new StringBuilder();
statement.append(
"SELECT COMPANY_NR, SHORT_NAME, NAME " +
"FROM COMPANY " +
"WHERE 1=1 ");
if (!StringUtility.isNullOrEmpty(formData.getShortName().getValue())) {
statement.append("AND UPPER(SHORT_NAME) LIKE UPPER(:shortName || '%') ");
}
if (!StringUtility.isNullOrEmpty(formData.getName().getValue())) {
statement.append("AND UPPER(NAME) LIKE UPPER(:name || '%')");
}
return SQL.select(statement.toString(), formData);
}
In MarsM4 Object[][] execLoadTableData is deprecated and protected void execLoadData(SearchFilter filter) should be used.
So far so good, the initial call works as expected and my tabelpage gets populated. But when I enter a search criteria in my search form and press "Search" nothing happens. Looking at the code an empty Search Handler is invoked, but then nothing else happens then.
So right now, I don't know how the according Tablepage#execLoadData(SearchFilter filter) gets called once again with the entered search criterias.
Do you have any ideas how this could work?
Thanks, Peter
|
|
| |
Re: Scout Mars M4 and SearchForms [message #1536683 is a reply to message #1536418] |
Tue, 30 December 2014 11:03 |
|
Jeremie Bresson wrote on Tue, 30 December 2014 07:33
You do not land there, when you click on the search button? I need to try it, because it should work.
After updating to the newest nightly build i get to the breakpoints. BUT now I get the following error when clicking on an entry in the TablePage after submitting a search
!MESSAGE org.eclipse.scout.rt.client.ui.basic.table.AbstractTable.resolveRows(AbstractTable.java:3718) could not resolve row InternalTableRow[1,017, _Fichte, 70+ (2/2), 25, 0.49, 0.49, 0.27, 0.00, 0.10, , , , , true, true, , PICEA abies, true, false, -1]
My TablePage execLoadData looks like this:
@Override
protected void execLoadData(SearchFilter filter) throws ProcessingException {
ArticlesSearchFormData searchFormData = (ArticlesSearchFormData) filter.getFormData();
if (searchFormData == null) {
searchFormData = new ArticlesSearchFormData();
}
ArticlesTablePageData pageData = (ArticlesTablePageData) SERVICES.getService(IStandardOutlineService.class).getArticleTableData(searchFormData);
importPageData(pageData);
}
And my service implementation like this:
@Override
public AbstractTablePageData getArticleTableData(ArticlesSearchFormData searchFormData) throws ProcessingException {
StringBuilder whereClause = new StringBuilder("WHERE 1 = 1 ");
ArticlesTablePageData pageData = new ArticlesTablePageData();
if (!StringUtility.isNullOrEmpty(searchFormData.getArticleName().getValue())) {
whereClause.append(" AND UPPER(ArticleName) LIKE UPPER ('%' || :articleName || '%')");
}
SQL.selectInto("SELECT ID, ArticleName, Sort, Bunch, PriceBBK, StandardPrice, WholesalePrice, AcquisitionPrice, VAT, PricelistBBK, PricelistGeneral, LatinName, PricelistProducer, deleted, UserID "
+ "FROM Articles "
+ whereClause.toString()
+ " INTO :iD, :articleName, :sortType, :bunch, :priceBBK, :standardPrice, :wholesalePrice, :acquisitionPrice, :vAT, :pricelistBBK, :pricelistGeneral, :latinName, :pricelistProducer, :deleted, :userID", pageData);
return pageData;
}
|
|
|
Re: Scout Mars M4 and SearchForms [message #1550753 is a reply to message #1536683] |
Wed, 07 January 2015 07:48 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
Peter Pfeifer wrote on Tue, 30 December 2014 12:03After updating to the newest nightly build i get to the breakpoints. BUT now I get the following error when clicking on an entry in the TablePage after submitting a search
!MESSAGE org.eclipse.scout.rt.client.ui.basic.table.AbstractTable.resolveRows(AbstractTable.java:3718) could not resolve row InternalTableRow[1,017, _Fichte, 70+ (2/2), 25, 0.49, 0.49, 0.27, 0.00, 0.10, , , , , true, true, , PICEA abies, true, false, -1]
This might be a bug in the table, but I am not able to reproduce it. The search form is not involved here.
Can you give more detail? About the Columns and the Data? (I assume one column and one value are responsible).
Peter Pfeifer wrote on Tue, 30 December 2014 12:03My TablePage execLoadData looks like this:
(...)
And my service implementation like this:
This is a detail, but: your method getArticleTableData() could directly return an ArticlesTablePageData instead of an AbstractTablePageData.
|
|
|
Goto Forum:
Current Time: Sat Apr 27 01:07:51 GMT 2024
Powered by FUDForum. Page generated in 0.02699 seconds
|