製品版のみの機能
エディター - 日付エディター MVC
このサンプルは CTP 機能を使用しています。製品版では、API や動作が変更される場合があります。
航空券の予約
このサンプルは、より大きい画面サイズのためにデザインされました。
モバイル デバイスで画面を回転、フル サイズ表示、またはその他のデバイスにメールで送信します。
このサンプルは、MVC ラッパーを使用した igDateEditor の基本オプションを紹介します。
コード ビュー
クリップボードへコピー
@using Infragistics.Web.Mvc <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title></title> <!-- Ignite UI for jQuery Required Combined CSS Files --> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/structure/infragistics.css" rel="stylesheet" /> <style> h3 { font-size: 20px; margin-bottom: 20px; } .group-fields { margin-bottom: 10px; } .group-fields label { display: block; line-height: 18px; } .group-fields .inline { display: inline; } .group-fields .ui-igcheckbox-normal { margin-right: 5px; float: left; } .group-fields .ui-igedit-container { width: 230px; } .clearfix:after { content: ""; display: table; clear: both; } .group-fields.clearfix > div { float: left; margin-right: 10px; } </style> <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script> <!-- Ignite UI for jQuery Required Combined JavaScript Files --> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.core.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.lob.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/modules/i18n/regional/infragistics.ui.regional-i18n.js"></script> </head> <body> <h3>航空券の予約</h3> <div class ="group-fields"> <label for="currentTime">今日</label> @(Html.Infragistics().DateEditor() .ID("currentTime") .DateInputFormat("dateTime") .Value(DateTime.Now) .Render() ) </div> <div class="group-fields clearfix"> <div> <label for="departure">往路</label> @(Html.Infragistics().DateEditor() .ID("departure") .DateInputFormat("yyyy 年 M 月 d 日 (ddd)") .Value(DateTime.Today) .AddClientEvent(EditorClientEvents.ValueChanged, "valueChanged") .Render() ) </div> <div> <label for="departureTime">前後</label> @(Html.Infragistics().DateEditor() .ID("departureTime") .Width(100) .DateInputFormat("hh:mm") .Value(DateTime.Now) .ButtonType(TextEditorButtonType.Spin) .Render() ) </div> </div> <div class="group-fields clearfix"> <div> <label for="return">復路</label> @(Html.Infragistics().DateEditor() .ID("return") .DateInputFormat("yyyy 年 M 月 d 日 (ddd)") .Value(DateTime.Now.AddDays(1)) .Render() ) </div> <div> <label for="returnTime">前後</label> @(Html.Infragistics().DateEditor() .ID("returnTime") .Width(100) .DateInputFormat("hh:mm") .Value(DateTime.Now) .ButtonType(TextEditorButtonType.Spin) .Render() ) </div> </div> <div class="group-fields"> @(Html.Infragistics().CheckBoxEditor() .ID("oneWayTicket") .Checked(false) .AddClientEvent(EditorClientEvents.ValueChanged, "oneWayTicket") .Render() ) <label for="oneWayTicket">片道</label> </div> <script type="text/javascript"> function valueChanged(evt, ui) { if (ui.newValue instanceof Date) { var nextDay = new Date(ui.newValue.getTime() + 24 * 60 * 60 * 1000); $("#return").igDateEditor("option", "value", nextDay); } } function oneWayTicket(evt, ui) { if (ui.newState == true) { $("#return").igDateEditor("option", "disabled", true); $("#returnTime").igDateEditor("option", "disabled", true); } else { $("#return").igDateEditor("option", "disabled", false); $("#returnTime").igDateEditor("option", "disabled", false); } } </script> </body> </html>
using IgniteUI.SamplesBrowser.Models.DataAnnotations; using IgniteUI.SamplesBrowser.Models.Northwind; using IgniteUI.SamplesBrowser.Models.Repositories; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace IgniteUI.SamplesBrowser.Controllers { public class EditorsController : Controller { // // GET: /Editors/ [ActionName("data-annotation-validation")] public ActionResult DataAnnotationValidation() { ValidatedOrder model = new ValidatedOrder(); ViewData["message"] = String.Empty; model.ShipMethodList = this.GetShipMethods(); return View("data-annotation-validation", model); } [HttpPost] [ActionName("data-annotation-validation")] public ActionResult DataAnnotationValidation(ValidatedOrder model) { if (ModelState.IsValid) { ViewData["message"] = "製品を保存しました"; } model.ShipMethodList = this.GetShipMethods(); return View("data-annotation-validation", model); } [ActionName("load-and-save-form-values")] public ActionResult EditProduct() { Product product = RepositoryFactory.GetProductRepository().Get().First(); ViewData["message"] = String.Empty; return View("load-and-save-form-values", product); } [ActionName("text-editor-mvc")] public ActionResult TextEditor() { return View(); } [ActionName("date-editor-mvc")] public ActionResult DateEditor() { return View(); } [ActionName("numeric-editor-mvc")] public ActionResult NumericEditor() { return View(); } [ActionName("mask-editor-mvc")] public ActionResult MaskEditor() { return View(); } public List<SelectListItem> GetShipMethods() { List<SelectListItem> selectList = new List<SelectListItem>() { new SelectListItem { Text = "標準", Value = "Standard" }, new SelectListItem { Text = "1 日", Value = "OneDay" }, new SelectListItem { Text = "2 日", Value = "TwoDay" }, new SelectListItem { Text = "海外発送", Value = "International" } }; return selectList; } } }