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. web请求的拦截与处理

    1,特定请求的拦截:spring或struct2的拦截器,指定拦截模式和处理的servlet: 2,非特定的恶意非法请求,web.xml的error-page元素可以接受tomcat返回的错误代码,并 ...

  2. [spring源码学习]五-BeanPostProcessor的使用

    一.接口描述 spring提供了一个接口类-BeanPostProcessor,我们叫他:bean的加工器,应该是在bean的实例化过程中对bean做一些包装处理,里边提供两个方法 public in ...

  3. Tastypie与Backbone交互

    上回玩到Tastypie与jQuery交互,那么现在接着玩玩Tastypie与Backbone.js交互 先把上篇的template文件:D:\project\tastypie\mysite\blog ...

  4. Webpack 入门指迷--转载(题叶)

    最近看到这个东西,一头雾水.看了一些资料了解了Webpack概念,大体是webpack 是一个模块绑定器,主要目的是在浏览器上绑定 JavaScript 文件. 看到题叶写的一篇介绍,写的很好,转载连 ...

  5. Eclipse中快速删除空行

    1.在要编辑的文档中 "Ctrl"+"F",弹出搜索框: 2.在Find文本框中输入正则表达式:^\s*\n 3.勾选正则表达式选项: 4.Find和替换所有.

  6. C语言_第三章

    1.常量        1.整型常量        2.实型常量                1.十进制小数形式,由数字和小数点组成.                2.指数形式(以E或e代表以10 ...

  7. Jquery_类选择器笔记

    $("[id^=percent]").size() ^=:表示以什么开头 $=:表示以什么结尾 ~=:表示包含什么 id:表示按id选择

  8. hibernate 的SessionFactory的getCurrentSession 与 openSession() 的区别

    1 getCurrentSession创建的session会和绑定到当前线程,而openSession不会. 2 getCurrentSession创建的线程会在事务回滚或事物提交后自动关闭,而ope ...

  9. 免费领取百度云盘2048G永久空间,永久离线下载特权

    百度云盘和360云盘之间的竞争可谓争锋相对,前段时间,百度和360就网盘免费都采取了自己的措施,最终,360一锤定音,直接免费送36T,并且如果你超过了36T的容量,还可以自动免费扩容! 可参看文章: ...

  10. Java 对象拷贝方式

    (1)BeanUtils.cloneBean()使用: http://www.cnblogs.com/fervour/archive/2009/12/18/1627868.html package c ...