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. linux下 html转pdf

    其实很简单的, 在当前文件夹中打开终端, 只需要一个命令就好 wkhtmltopdf test.html test.pdf 这样一个test.html的文件就转为test.pdf 的pdf文件啦!

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

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

  3. 立flag

    lixintong这半年来一直浪啊浪啊都不认真做题!!!!!!简直是太堕落啦!!lixintong非常讨厌这样的lixintong !!! 鉴于lixintong NOIP 完全爆炸啦! lixint ...

  4. istringstream的操作

    今天在stackoverflow上看到这么个问题,写完之后看了看别人的提交的答案,感觉自己的答案虽然能得出正确结果但是有点啰嗦,对于c++还是没有熟练,没有想起有istringstream,而且提问的 ...

  5. Slave作为其它Slave的Master时使用

    主从配置需要注意的点 (1)主从服务器操作系统版本和位数一致: (2) Master和Slave数据库的版本要一致: (3) Master和Slave数据库中的数据要一致: (4) Master开启二 ...

  6. Ajax调用Conrtoller返回数据

    前端ajax function doRefund(){ $.ajax({ type: "POST", catch: false, url: "@Url.Action(&q ...

  7. php上传大文件时,服务器端php.ini文件中需要额外修改的选项

    几个修改点: 1.upload_max_filesize 上传的最大文件 2.post_max_size 上传的最大文件 3.max_execution_time 修改为0表示无超时,一直等待 4.m ...

  8. [skill] 进程 线程

    在业务逻辑上: 进程线程没有区别. 在系统资源上: 进程拥有自己的地址空间.线程拥有自己的堆栈和临时变量,与其他线程共享地址空间. 在通信代价上: 线程间通信代价更低,实现更方便.进程通信相对开销比较 ...

  9. 关于 Pragma 的使用总结

    注意:此文乃是本人阅读多个博客文章后,记下的个人认为重点的地方. 参考文章: 参考1   参考2 #Pragma mark - 用于分离类中的不同功能的方法.(例如,一个 viewController ...

  10. sublime text3配置node.js开发环境

    今天配置sublime下node.js网上搜索很多方法. 首先:传统的方法是 1.GIT方法 可直接输入 Git clone https://github.com/tanepiper/SublimeT ...