Sep 03, 2010, 11:53 AM
[CLOSED] Issues using CompositeField of DateField and TimeField as grid column Editor
Hi,
In an editable grid scenario, we need to support the entry of date-time in one column. In my situation, I am dynamically generating my columns and giving them editors like this:
Because an Editor can only have one field added to it, I was about to write here that I wasn't sure how to do this, but then remembered you have CompositeFields! So I edited your example here:
https://examples1.ext.net/#/GridPane..._DirectMethod/
I made the following change:
Existing:
Problems (all in edit mode):
Any thoughts?
In an editable grid scenario, we need to support the entry of date-time in one column. In my situation, I am dynamically generating my columns and giving them editors like this:
_column.Editor.Add(new DateField())
However, I need to support a Date *and* Time entry on the grid for a *single* column.Because an Editor can only have one field added to it, I was about to write here that I wasn't sure how to do this, but then remembered you have CompositeFields! So I edited your example here:
https://examples1.ext.net/#/GridPane..._DirectMethod/
I made the following change:
Existing:
<ext:DateColumn Header="Last Updated" DataIndex="LastChange" Format="yyyy-MM-dd">
<Editor>
<ext:DateField runat="server" />
</Editor>
</ext:DateColumn>
My change 1 (markup):<ext:Column Header="Last Updated" DataIndex="LastChange">
<Renderer Fn="dateTime" />
<Editor>
<ext:CompositeField ID="DateField1" runat="server">
<Items>
<ext:DateField ID="CompositeDateField1" runat="server" />
<ext:TimeField ID="CompositeTimeField1" runat="server" />
</Items>
</ext:CompositeField>
</Editor>
</ext:Column>
My change 2 (the dateTime renderer JavaScript -- though I need to add more checking of "value" later):var dateTime = function (value) {
return value.format ? value.format('Y-m-d H:i:s') : value;
}
What worked:- Column rendered showing date and time (and with a custom renderer - great!)
- Column went into edit mode when double clicked and showed separate date field and time field (fantastic!)
Problems (all in edit mode):
- (Minor) Is there a way to automatically widen the column to fit the date and time fields?
- (Major) When I edited the date and time, it did not show the notification etc that happens when editing other columns.
- I couldn't figure out what to do here.
- From what I could tell, the afterEdit JavaScript handler was not firing (testing by doing console.log("afterEdit", e) and saw nothing in Firebug).
Any thoughts?
Last edited by Daniil; Sep 06, 2010 at 1:59 PM.
Reason: [CLOSED]