|
Re: Different Cell types in the same column [message #1278724 is a reply to message #1278700] |
Thu, 27 March 2014 19:16 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
Yes and No.
I mean you need a Type for your column, but this type can be Object.
In this case you need to handle:
- What will be displayed in the Cell: execDecorateCell
- The field that will be used when your value is edited: execPrepareEdit
public class AnswerColumn extends AbstractColumn<Object> {
@Override
protected String getConfiguredHeaderText() {
return TEXTS.get("Answer");
}
@Override
protected void execDecorateCell(Cell cell, ITableRow row) throws ProcessingException {
if(CompareUtility.equals("DOB", getQuestionColumn().getValue(row))) {
cell.setText(DateUtility.format((Date)getValue(row), "yyyy-mm-dd"));
} else if (CompareUtility.equals("Gender", getQuestionColumn().getValue(row))) {
cell.setText(getValue(row).toString());
}
}
@Override
protected IFormField execPrepareEdit(ITableRow row) throws ProcessingException {
if(CompareUtility.equals("DOB", getQuestionColumn().getValue(row))) {
return <a date field>;
} else if (CompareUtility.equals("Gender", getQuestionColumn().getValue(row))) {
return <a smart field>;
}
}
}
Instead of testing the value QuestionColumn you should consider adding an undisplayable column containing information about the type of the AnswerColumn.
That said, I am still asking me if this pattern makes sense. I am not convinced, but it probably depends on your use case.
.
|
|
|
|
|
|
|
Re: Different Cell types in the same column [message #1281058 is a reply to message #1280980] |
Mon, 31 March 2014 09:51 |
Dominic Hanlan Messages: 98 Registered: July 2009 |
Member |
|
|
Hi,
big problems with the basic method outlined in your original reply. When the field is first edited and I hit enter the value is shown. If I then re-edit the field the original value is still shown when I hit enter. If I then re-edit the field and hit enter the previous edit value is shown, i.e. the row value is always one behind.
What am I missing???
Regards
[Updated on: Mon, 31 March 2014 09:52] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04098 seconds