I have searched far and wide but have yet to see someone use widgets and then get the value of a widget with getSelectedRecords()
The goal of this solution is to have and end user check a few checkboxes and in the same row of the item that was checkboxed they should have selected a value for the state.
Currently I have a list grid with 4 rows:
Checkbox, 2 string text rows, DyanmicFrom(SelectItem)
How I am creating the SelectItem to get inside of the ListGrid:
theGrid= new ListGrid()
{
@Override
protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum)
{
String fieldName = this.getFieldName(colNum);
if (fieldName.equals("stateDropDown"))
{
DynamicForm rtrnForm = new DynamicForm();
SelectItem state= new SelectItem();
state.setShowTitle(false);
state.setHeight(25);
state.setWidth(175);
state.setDefaultToFirstOption(true);
rtrnForm.setFields(state);
loadFunctionStates(state);
return rtrnForm;
}
else
{
return null;
}
}
}; ;
}
theGrid.setSelectionType(SelectionStyle.SIMPLE);
theGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
theGrid.setShowRecordComponents(true);
theGrid.setShowRecordComponentsByCell(true);
Further down in the code we are then trying to get the record so that we can send the values else where in the system.
for (ListGridRecord record : theGrid.getSelectedRecords())
{
int index = 0;
for (String key : record.getAttributes())
{
// this is the column of the dynamicForm(SelectItem) objects that I need to get the value for the SelectItem
if (index == 5)
{
SC.logDebug(key + " : " + record.getAttribute(key));
SC.logDebug(key + " : " + record.getAttributeAsObject(key));
DynamicForm df = (DynamicForm) record.getAttributeAsObject(key);
}
else
{
SC.logDebug(key + " : " + record.getAttribute(key));
}
index++;
}
}
the problem is I can't get the SelectItem's value by using the Checkbox solution.. Does anyone have any other ideas?
The goal of this solution is to have and end user check a few checkboxes and in the same row of the item that was checkboxed they should have selected a value for the state.
Currently I have a list grid with 4 rows:
Checkbox, 2 string text rows, DyanmicFrom(SelectItem)
How I am creating the SelectItem to get inside of the ListGrid:
theGrid= new ListGrid()
{
@Override
protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum)
{
String fieldName = this.getFieldName(colNum);
if (fieldName.equals("stateDropDown"))
{
DynamicForm rtrnForm = new DynamicForm();
SelectItem state= new SelectItem();
state.setShowTitle(false);
state.setHeight(25);
state.setWidth(175);
state.setDefaultToFirstOption(true);
rtrnForm.setFields(state);
loadFunctionStates(state);
return rtrnForm;
}
else
{
return null;
}
}
}; ;
}
theGrid.setSelectionType(SelectionStyle.SIMPLE);
theGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
theGrid.setShowRecordComponents(true);
theGrid.setShowRecordComponentsByCell(true);
Further down in the code we are then trying to get the record so that we can send the values else where in the system.
for (ListGridRecord record : theGrid.getSelectedRecords())
{
int index = 0;
for (String key : record.getAttributes())
{
// this is the column of the dynamicForm(SelectItem) objects that I need to get the value for the SelectItem
if (index == 5)
{
SC.logDebug(key + " : " + record.getAttribute(key));
SC.logDebug(key + " : " + record.getAttributeAsObject(key));
DynamicForm df = (DynamicForm) record.getAttributeAsObject(key);
}
else
{
SC.logDebug(key + " : " + record.getAttribute(key));
}
index++;
}
}
the problem is I can't get the SelectItem's value by using the Checkbox solution.. Does anyone have any other ideas?
Comment