EXTJS:月/日选择器(即没有年份)

发布于 2024-10-14 08:30:04 字数 381 浏览 1 评论 0原文

我目前在我的应用程序中使用 EXTJS EditorGridPanel,对于其中一个列输入,我要求用户能够选择月份和日期(无年份)。

我目前正在使用 DateField 来执行此操作,但我需要能够在 UI 中禁用它的“年份”方面。我不在乎“价值”最终是否与年份相关,我可以简单地忽略它。我搜索过是否有人做过这样的事情,但我唯一的发现是人们以这种方式仅显示月/年。

我的另一种选择是创建自己的自定义输入(带有月份和日期的组合框,其中日期组合根据月份而变化),但是,老实说,我没有那么多时间自己制作一个,因为我必须因为我以前从未创建过自定义输入扩展,所以请完成学习曲线。

-->所以我的大问题是,有人听说过现有的 EXTJS 月/日选择器吗?

任何帮助都将非常适合堆栈溢出的人们!

I am currently using a EXTJS EditorGridPanel in my application, and for one of the column inputs I require the user to be able to pick a month and day (no year).

I am currently using a DateField to do this, but I need to be able to disable the "year" aspect of it in the UI. I do not care if the "value" in the end has a year associated with it, I can simply disregard it. I have searched to see if anyone has done such a thing, but my only findings are people that way to show only Month/Year.

My other option is to create my own custom input (with comboboxes for month and day, where the day combo changes based on the month), however, I honestly don't have all that much time to make one myself as I would have to go through the learning curve since I have never created a custom input extension before.

--> So my big question then is, has anyone heard of an existing EXTJS month/day picker?

Any help would be much appropriated stack overflow peoples!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

贩梦商人 2024-10-21 08:30:04

尽管我可能会创建自己的自定义组件来用作编辑器,但如果您不习惯这样做,您是否考虑过将“月”和“日”字段分解为网格列模型中的单独列?

另一种选择是向文本字段添加输入掩码(您需要在 cm 中指定一个输入掩码作为自定义编辑器)。我相信这是通过自定义 vtype 完成的。此输入掩码将强制用户以您指定的格式输入日期。

使用此方法将:

  1. 将所有月/日数据保留在一列中,
  2. 通过使用开箱即用的组件简化您的 UI 代码。 (我认为这是学习 ExtJS 的关键)

Although I would probably create my own custom component to use as the editor, if you're not comfortable doing that, have you considered breaking the Month and Day fields into separate columns in your grid column model?

Another option would be to add a input mask to the textfield (you'll need to specify one as a customEditor in your cm). I believe this is done via custom vtypes. This input mask would force the user to enter the date in the format that you specify.

Using this approach would :

  1. keep all month/day data in one column
  2. simplifies your UI code by using the out-of-the-box components. (IMO this is key for learning ExtJS)
清晰传感 2024-10-21 08:30:04

试试这个

  picker: {
    slotOrder: [ 'month', 'day' ]
  }

您的帖子似乎包含代码格式不正确的代码。请使用代码工具栏按钮或 CTRL+K 键盘快捷键将所有代码缩进 4 个空格。如需更多编辑帮助,请单击 [?] 工具栏图标。

try this one

  picker: {
    slotOrder: [ 'month', 'day' ]
  }

Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon.

心在旅行 2024-10-21 08:30:04

尝试这样的事情:

{
    xtype: 'datepickerfield',
    name: 'OrderDate',
    label: 'Order Date',
    picker: { yearTo: 2011, yearFrom: 2020 }
}

我希望这会对您有所帮助。

Try something like:

{
    xtype: 'datepickerfield',
    name: 'OrderDate',
    label: 'Order Date',
    picker: { yearTo: 2011, yearFrom: 2020 }
}

I hope this will help you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文