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. 2016 Multi-University Training Contest 1 H.Shell Necklace

    Shell Necklace Time Limit: 16000/8000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)T ...

  2. c# 获取项目的根目录

    编写程序的时候,经常需要用的项目根目录.自己总结如下 1.取得控制台应用程序的根目录方法     方法1.Environment.CurrentDirectory 取得或设置当前工作目录的完整限定路径 ...

  3. 李洪强iOS经典面试题142-第三方框架及其管理

    李洪强iOS经典面试题142-第三方框架及其管理   第三方框架及其管理 使用过CocoaPods吗?它是什么?CocoaPods的原理? CocoaPod是一个第三方库的管理工具,用来管理项目中的第 ...

  4. First step to Signal —— in Linux C Programing

    1. What's signal 信号是软件中断,提供了一种处理异步事件的方法.(见<Unix环境高级编程>)一般使用时需包含 signal.h 库. 每个信号命名由SIG开头,实际值为正 ...

  5. <八>JDBC_重构DAO查询方法

    DAO类: import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import ...

  6. Python打包成exe:屡试不爽的cxfreeze!

    Python用cxfreeze打包,不用像什么Pyinstaller繁杂的写配置文件,一行命令足以! 安装好cxfreeze后,进行python脚本目录,执行: C:\Python27\Scripts ...

  7. ThinkPHP 错误: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'

    在配置了ThinkPHP 的数据库配置信息后,在实例化Model(),调用相关方法时候 出现错误,改进如下方式后解决: 找到php.ini 的文件,打开扩展  php_pdo_mysql.dll ,然 ...

  8. 文本编辑器VIM/VI

    vim/vi  功能强大全屏文本编辑器.主要是建立,编辑,显示文本. www.vim.org  构建shell脚本 :set number 使文件出现行号 a 光标后附件文件     i在光标前插入文 ...

  9. HTML中行内元素与块级元素的区别:

    HTML中行内元素与块级元素的区别:在标准文档流里面,块级元素具有以下特点: ①总是在新行上开始,占据一整行:②高度,行高以及外边距和内边距都可控制:③宽带始终是与浏览器宽度一样,与内容无关:④它可以 ...

  10. Android课程---添加黑名单的练习(课堂讲解)

    DBHelper.java package com.hanqi.test3; import android.content.Context; import android.database.sqlit ...