When I was using Umbraco datetime property editor, I met with a problem that the editor must be first time initialized with value, if I want to change the value later after the control is rendered, I have to use javascript.

Below pasted the code.

editor part:

 <umb-property property="ExpiryDate">
<umb-editor model="ExpiryDate"></umb-editor>
</umb-property>

the controller initialization part:

function buildDateTimePickerModel(alias, label, description, value) {
return {
editor: "Umbraco.DateTime",
label: label,
description: description,
hideLabel: false,
view: "datepicker",
alias: alias,
value: value,
validation: {
mandatory: false,
pattern: ""
},
config: {
dateFormat: "YYYY-MM-DD HH:mm:ss",
pickDate: true,
pickTime: true,
useSeconds: true
}
};
};
$scope.ExpiryDate = buildDateTimePickerModel('ExpiryDate', 'ExpiryDate', 'Enter the ExpiryDate', null);

  so, this code will guarantee that at least you can see the control as soon as it is loaded, but, you can see, what if I have a asynchonous model that I need to apply to this control later? my current solution is to find the control by its id, and then apply value to it with formatters, all these stuffs are actually wrapped in an angular js controller, so, the setter method of the control would be:

$('#ExpiryDate').val($filter('date')($scope.CouponCode.ExpiryDate, 'yyyy-MM-dd hh:mm:ss'));

  anywhere!

How to use umbraco datetime property editor的更多相关文章

  1. XAF-如何修改内置的编辑器(Property Editor)

    本示例演示在web/win中给 日期选择控制显示出一个时钟及修改时间的控件.效果如下: 如果你装了XAF在这个路径中已经有了这个示例: %PUBLIC%\Documents\DevExpress De ...

  2. XAF Spreadsheet property Editor

    https://www.devexpress.com/Support/Center/Question/Details/T371232

  3. 第15.11节 PyQt(Python+Qt)入门学习:Qt Designer(设计师)组件Property Editor(属性编辑)界面中主窗口QMainWindow类相关属性详解

    概述 主窗口对象是在新建窗口对象时,选择main window类型的模板时创建的窗口对象,如图: 在属性编辑界面中,主窗口对象与QMainWindow相关的属性包括:iconSize.toolButt ...

  4. Format a Property Value 设置属性值的格式

    In this lesson, you will learn how to set a display format and an edit mask to a business class prop ...

  5. [翻译] Writing Property Editors 编写属性编辑器

    Writing Property Editors 编写属性编辑器   When you select a component in the designer its properties are di ...

  6. How to: Specify a Display Member (for a Lookup Editor, Detail Form Caption, etc.)如何:指定显示成员(用于查找编辑器、详细信息表单标题等)

    Each business object used in an XAF application should have a default property. The default property ...

  7. Make a Property Calculable 使属性可计算

    In this lesson, you will learn how to manage calculated properties. For this purpose, the Payment cl ...

  8. Add an Editor to a Detail View 将编辑器添加到详细信息视图

    In this lesson, you will learn how to add an editor to a Detail View. For this purpose, the Departme ...

  9. Access Editor Settings 访问编辑器设置

    This topic demonstrates how to access editors in a Detail View using a View Controller. This Control ...

随机推荐

  1. VS2010 有关测试的一些使用

    Visual Studio 2010 单元测试之一---普通单元测试:http://blog.csdn.net/tjvictor/archive/2011/02/09/6175362.aspx   V ...

  2. (iOS)项目总结-项目中遇到的各种的问题和解决方法

    前言: 一到公司报道那时,便着手独立的去完成了一个项目,其中的辛酸泪也是不足为外人道也.这次算是一个新型的app,仍然是独立开发,但心境和想法却是完全的不同.下面说一次以前做开发时常常忽略的知识,也算 ...

  3. Leetcode Valid Sudoku

    Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be ...

  4. db2无法force掉备份连接的处理办法

    在数据库在线备份的时候会与Load和ALTER TABLE <表名> ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE发生冲突导致这两种操作被挂 ...

  5. ZeroMQ接口函数之 :zmq_strerror - 获取ZMQ错误描述字符串

    ZeroMQ 官方地址 :http://api.zeromq.org/4-0:zmq_strerror zmq_strerror(3) ØMQ Manual - ØMQ/4.1.0 Name zmq_ ...

  6. [Android]关于filed 遍历资源文件的排序问题

    Field[] svgfields = R.drawable.class.getFields(); listid = new ArrayList<Integer>(); for (Fiel ...

  7. java并发控制:lock

    一.synchronized的缺陷 synchronized是java中的一个关键字,也就是说是Java语言内置的特性.那么为什么会出现Lock呢? 在上面一篇文章中,我们了解到如果一个代码块被syn ...

  8. javascript函数小练习

    求n-m之间数据的和 <script> function num(n,m){ var sum=0; for (var i = n; i <= m; i++) { sum+=i; } ...

  9. ArithUtil工具类 : 精确计算各种运算

    package com.autoserve.mh.common.util;   import java.math.BigDecimal; import java.text.DecimalFormat; ...

  10. C#网络编程之---TCP协议的同步通信(二)

    上一篇学习日记C#网络编程之--TCP协议(一)中以服务端接受客户端的请求连接结尾既然服务端已经与客户端建立了连接,那么沟通通道已经打通,载满数据的小火车就可以彼此传送和接收了.现在让我们来看看数据的 ...