mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Add maxRows field (todo - show in UI if you didn't fetch all?)
This commit is contained in:
@ -53,6 +53,7 @@ import com.kingsrook.qqq.backend.core.model.metadata.joins.JoinOn;
|
|||||||
import com.kingsrook.qqq.backend.core.model.metadata.joins.QJoinMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.joins.QJoinMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.utils.JsonUtils;
|
import com.kingsrook.qqq.backend.core.utils.JsonUtils;
|
||||||
|
import com.kingsrook.qqq.backend.core.utils.StringUtils;
|
||||||
import com.kingsrook.qqq.backend.core.utils.ValueUtils;
|
import com.kingsrook.qqq.backend.core.utils.ValueUtils;
|
||||||
import org.apache.commons.lang.BooleanUtils;
|
import org.apache.commons.lang.BooleanUtils;
|
||||||
|
|
||||||
@ -117,6 +118,17 @@ public class ChildRecordListRenderer extends AbstractWidgetRenderer
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public Builder withMaxRows(Integer maxRows)
|
||||||
|
{
|
||||||
|
widgetMetaData.withDefaultValue("maxRows", maxRows);
|
||||||
|
return (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
@ -151,6 +163,12 @@ public class ChildRecordListRenderer extends AbstractWidgetRenderer
|
|||||||
QJoinMetaData join = input.getInstance().getJoin(joinName);
|
QJoinMetaData join = input.getInstance().getJoin(joinName);
|
||||||
String id = input.getQueryParams().get("id");
|
String id = input.getQueryParams().get("id");
|
||||||
|
|
||||||
|
Integer maxRows = null;
|
||||||
|
if(StringUtils.hasContent(input.getQueryParams().get("maxRows")))
|
||||||
|
{
|
||||||
|
maxRows = ValueUtils.getValueAsInteger(input.getQueryParams().get("maxRows"));
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// fetch the record that we're getting children for. //
|
// fetch the record that we're getting children for. //
|
||||||
// e.g., the left-side of the join, with the input id //
|
// e.g., the left-side of the join, with the input id //
|
||||||
@ -182,6 +200,7 @@ public class ChildRecordListRenderer extends AbstractWidgetRenderer
|
|||||||
queryInput.setShouldTranslatePossibleValues(true);
|
queryInput.setShouldTranslatePossibleValues(true);
|
||||||
queryInput.setShouldGenerateDisplayValues(true);
|
queryInput.setShouldGenerateDisplayValues(true);
|
||||||
queryInput.setFilter(filter);
|
queryInput.setFilter(filter);
|
||||||
|
queryInput.setLimit(maxRows);
|
||||||
QueryOutput queryOutput = new QueryAction().execute(queryInput);
|
QueryOutput queryOutput = new QueryAction().execute(queryInput);
|
||||||
|
|
||||||
QTableMetaData table = input.getInstance().getTable(join.getRightTable());
|
QTableMetaData table = input.getInstance().getTable(join.getRightTable());
|
||||||
|
Reference in New Issue
Block a user