从模型 Sencha Touch 更新 Datepickerfield
我有一个模型和商店,它从我的表单字段中获取值。 我的表单包含文本字段、选择字段、日期选择字段和单选字段。
我从表单中获取值并用它们更新我的模型。当稍后我将模型加载到表单中时,这些值会重新出现在除日期选择器字段之外的所有组件上。
我使用本地存储代理。我检查了数据库中的值,日期显示为以下格式:“2011-12-13T18:30:00.000Z”
我认为这可能是问题所在。也许日期选择器字段不知道如何加载格式。我应该怎么办 ??
萨莎
I have a model and store that take in values from my form fields.
My form contains a textfield, selectfield, datepickerfield and radiofield.
I take the values from the form and update my model with them. When later I load the model into the form, the values reappear on all components EXCEPT the datepickerfield.
Im using a localstorage proxy. I checked the values in the database, the date shows in the following format : "2011-12-13T18:30:00.000Z"
I think this may be the problem. Maybe the datepickerfield doesnt know how to load the format. What should I do ??
Sasha
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用下面的代码将该日期格式转换为其他格式。
最初设置日期模式,即
然后按如下方式应用此日期模式,即
希望它会有所帮助...
You can convert that date formats to other using the code below .
Initially set the date patterns , ie
Then apply this date patterns as follows , ie
Hope it will help...
你告诉我的是格式化日期的方法,而不是如何做......
但日期仍然无法加载&格式错误。
不,实际上我找到了答案,这是你必须做的:
你的 showForm 控制器(在表单中加载日期)应该看起来像这样:
showForm :函数(参数){
要格式化日期,如果你使用 itemTpl 它应该是:
itemTpl : '{date:date("d M Y")}'
希望这对某人有帮助:D
What you're telling me is the ways to format the date, not how to do it…
But the date still doesnt load & the format is wrong.
No actually I found the answer, this is what you have to do :
Your showForm controller (to load the date in the form)should look something like this :
showForm : function (params) {
To format the date, incase ur using an itemTpl it shud be :
itemTpl : '{date:date("d M Y")}'
Hope this helps someone :D