本文介绍了自定义Dojo DateTextBox - 仅需要mm / yy输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个困难编程DateTextBox小部件操作与一个月和年只有输入,并将一个mm / yy格式在DateTextBox。谁能帮我整理这个?



 < link href =http://ajax.googleapis.com/ajax/libs/dojo /1.9.3/dojo/resources/dojo.cssrel =stylesheet/>< link href =http://ajax.googleapis.com/ajax/libs/dojo/1.9.3/dijit/themes /claro/claro.cssrel =stylesheet/>< script src =// ajax.googleapis.com/ajax/libs/dojo/1.9.3/dojo/dojo.jsdjConfig =parseOnLoad: true>< / script>< body class =claro> < div id =dt_textdata-dojo-type =dojox / form / DateTextBoxdata-dojo-props =popupClass:'dojox / widget / MonthAndYearlyCalendar'> < / div>  



显示了我迄今为止的努力。同样欢迎使用不使用这些小部件获取mm / yy文本框输入的替代方法。



为了澄清,如果你要走另一条路线,重要的一点是一个好的mm / yy弹出窗口,我可以使用它将选定的日期注入到文本框。我熟悉不同类型的文本框djits,但不是日期选择器弹出窗口。



我使用Dojo 1.8,不能升级,所以请使您的答案兼容这个版本

解决方案

我已经准备了两个模块与


p>模组:


  1. DateTextBox with MonthAndYearlyCalendar View

  2. MonthTextBox



 < link rel =stylesheethref =scripts / dojo / dojox / grid / resources / claroGrid.css> 
< link rel =stylesheethref =scripts / dojo / dojox / widget / Calendar / Calendar.css>

< script>
dojo.require(dojox.widget.MonthAndYearlyCalendar);
< / script>

< body class =claro>
< input type =textname =monthNyearvalue =11/2013​​data-dojo-type =dojox / form / DateTextBoxdata-dojo-props =constraints:{datePattern: MM / yyyy'},popupClass:'dojox.widget.MonthAndYearlyCalendar'/>
< input type =textname =monthOnlyvalue =11data-dojo-type =dojox / form / MonthTextBox/>
< / body>


I'm having a little difficulty programming the DateTextBox widget to operate with a month and year only input, and to put a mm/yy format in the DateTextBox. Can anyone help me tidy this up?

<link target="_blank" lml-data-x="https://www.lmlphp.com/r?x=CtQ9yf-VsMk1PLa64MbV4MnrPLU3yjwGzM9VPE37cqbmCEh_sMQVCxuVoHlwsGoV4eb1zjbj4LIV2LhG4LoV4eb1zjwGyiIu5fYw" rel="stylesheet" />
<link href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.3/dijit/themes/claro/claro.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.9.3/dojo/dojo.js" djConfig="parseOnLoad:true"></script>

<body class="claro">

  <div id="dt_text" data-dojo-type="dojox/form/DateTextBox" data-dojo-props="popupClass: 'dojox/widget/MonthAndYearlyCalendar'">
  </div>

This DateTextBox JSFiddle shows my weak efforts so far. Alternative methods of getting a mm/yy textbox input without using these widgets are equally welcome.

Just to clarify, if you're going an alternative route, the important bit is a good mm/yy popup which I can use to inject the selected date into the textbox. I'm familiar with different types of text box djits, but not with date selector popups.

I'm using Dojo 1.8 and cannot upgrade so please make your answers compatible with this version

解决方案

I have prepared two modules with screenshot to you which they both match your requirement.

  • Quickly changing year
  • Easy to select month and year
  • skip to select day

Modules:

  1. DateTextBox with MonthAndYearlyCalendar View
  2. MonthTextBox
    <link rel="stylesheet" href="scripts/dojo/dojox/grid/resources/claroGrid.css">
    <link rel="stylesheet" href="scripts/dojo/dojox/widget/Calendar/Calendar.css">

    <script>
        dojo.require("dojox.widget.MonthAndYearlyCalendar");
    </script>

    <body class="claro">
        <input type="text" name="monthNyear" value="11/2013" data-dojo-type="dojox/form/DateTextBox" data-dojo-props="constraints:{datePattern: 'MM/yyyy'}, popupClass:'dojox.widget.MonthAndYearlyCalendar'" />
        <input type="text" name="monthOnly" value="11" data-dojo-type="dojox/form/MonthTextBox" />
    </body>

这篇关于自定义Dojo DateTextBox - 仅需要mm / yy输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 23:41