对话渲染方法只被触发一次 [英] Dialogue render method gets fired only once

查看:96
本文介绍了对话渲染方法只被触发一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有2个标签和一个对话框的屏幕。 Tab1有一个项目列表。当您单击Tab1中的某个项目时: 应用程序导航到Tab2,并在Tab1中显示与所选项目相关的详细信息项(子项) 。当
单击Tab2中的某个项目时,应用程序会在Tab2中显示与项目(选定)相关的详细项目(子项)的对话框。对话框的渲染代码在我第一次加载屏幕时运行...因此第一次在对话框中显示数据
。 请参阅下面的代码。


< pre class ="prettyprint"> myapp.UsersTestBrowse.QuestionOptionsListTemplate_render = function(element,contentItem){
// Approach 1.
if(contentItem.hookedEvents == undefined){
contentItem.dataBind (" value.OptionText",function(){
var control = GetControl(contentItem,'radio',contentItem.value.IdOption,contentItem.value.OptionText);
$(control).appendTo ($(元素));
});
}
};

如果我关闭对话并在一个项目中再次点击(在Tab2上),则不再显示数据。原因是对话框上的项目列表的渲染方法,除非我刷新整个表单,否则永远不会再次运行,它会将
带回Tab1。


I我已经尝试了我在论坛上找到的所有内容,并花了很多时间在这上面。此时我不确定我是做错了什么还是行为不受支持。任何帮助将不胜感激。





JCM

解决方案


 我无法全面了解您的场景,但这应该可行。除非我能看到您的内容树和自定义控件绑定,否则我无法确定它为什么不起作用。


这是我的示例内容树和后面的代码,对话框正确显示所选项目。希望这会有所帮助。



 myapp.BrowseTable1Items.Name1_render = function(element,contentItem){
contentItem.dataBind(" value",function( ){
element.innerText = contentItem.value;
});
};


自定义控件绑定到Text属性。这是proeprty表的截图。




I have a screen with 2 tabs and one dialogue. The Tab1 has a list of items. When you click in one of the items in Tab1: The application navigates to Tab2 and displays the detail items (children) related to the selected item in Tab1. When you click in one of the items in Tab2 the application displays a Dialogue with the detail items (children) related to the item (selected) in Tab2. The render code of the dialogue runs the first time I load the screen... so the first time the data is displayed in the dialogue. See code below.

myapp.UsersTestBrowse.QuestionOptionsListTemplate_render = function (element, contentItem) {
    // Approach 1.
    if (contentItem.hookedEvents == undefined) {
        contentItem.dataBind("value.OptionText", function () {
            var control = GetControl(contentItem, 'radio', contentItem.value.IdOption, contentItem.value.OptionText);
            $(control).appendTo($(element));
        });
    }
};

If I close the Dialogue and click a second time in one item (on Tab2) the data is not displayed anymore. The reason is the render method of the  item list on the dialogue, never runs again unless I refresh the whole form and it takes me back to Tab1.

I have tried everything I have found on the forum and spent many hours on this. At this point I am not sure if I am doing something wrong or the behavior is not supported. Any help will be appreciated.


JCM

解决方案

Hi,

  I can't quite get the full picture of your scenario, but this is supposed to work. Unless I can see your content tree and the custom control binding, I can't tell for sure why it is not working.

Here is my sample content tree and the code behind and the dialog correctly displays the selected item. Hope this helps.

myapp.BrowseTable1Items.Name1_render = function (element, contentItem) {
    contentItem.dataBind("value", function () {
        element.innerText = contentItem.value;
    });
};

And the custom control is bound to Text property. Here is the screenshot of proeprty sheet.


这篇关于对话渲染方法只被触发一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆