0

dhtmlschedular.js にカスタム テキスト フィールドを追加しましたが、

パスをトレースできません。カスタム フィールドの値をコントローラーで取得するにはどうすればよいですか。

または、データを db に保存するための dhtmlx の完全なフロー。

私はこれまでにやった:-

lightbox: {
        sections: [
            {name: "description", height: 200, map_to: "text", type: "textarea",             focus: true },
            { name:"prabhu", height:200, map_to:"txt1", type:"dhiraj"},
            {name: "time", height: 72, type: "time", map_to: "auto"}]


    dhiraj: {
        render:function(sns){
            return "<div class='dhx_cal_ltext' style='height:60px;'>Text&nbsp;<input id='txt1' name='txt1' type='text'><br/>Details&nbsp;<input id='calendarDetailId' name='txt2' type='text'></div>";
        },
        set_value:function(node,value,ev){
            node.childNodes[1].value=value||"";
            node.childNodes[4].value=ev.details||"";
        },
        get_value:function(node,ev){
            ev.location = node.childNodes[4].value;
            return node.childNodes[1].value;
        },
        focus:function(node){
            var a=node.childNodes[1]; a.select(); a.focus(); 
        }
    }
};
4

1 に答える 1

1

コンポーネントのソースを変更せずにカスタム フィールドを追加できます (可能な限り変更しないことをお勧めします)。

詳細フォームに別のコントロールを追加する必要がある場合は、scheduler.configuration.lightbox.sectionsオブジェクトを上書きできます (ソースではなく、ページ/スクリプト ファイル内)。

map_to」プロパティは、入力にマップされるデータ オブジェクト (イベント) のプロパティを定義します。コントロールを複数のフィールドにマップする必要がある場合は、map_to:"auto"を使用して、イベント オブジェクトから必要なフィールドを手動で取得できます。

ページのコードは次のようになります。

//defining a control
scheduler.form_blocks["dhiraj"]={
    render:function(sns){
        return "<div class='dhx_cal_ltext' style='height:60px;'>" +
                "Text&nbsp;<input id='txt1' name='txt1' type='text'><br/>" +
                "Details&nbsp;<input id='calendarDetailId' name='txt2' type='text'>" +
                "</div>";
    },
    set_value:function(node,value,ev){
        //get values from event manually
        node.childNodes[1].value = ev.txt1 || "";
        node.childNodes[4].value = ev.txt2 || "";
    },
    get_value:function(node,ev){
        //assign values to event object
        ev.txt1 = node.childNodes[1].value;
        ev.txt2 = node.childNodes[4].value;
    },
    focus:function(node){
        var a=node.childNodes[1]; a.select(); a.focus();
    }
};

//add control to the details form
scheduler.locale.labels.section_prabhu = "";//labels for inputs are defined as 'seciton_'+inputName
scheduler.config.lightbox.sections = [
    {name:"description", height:200, map_to:"text", type:"textarea" , focus:true},
    {name:"prabhu", height:200, map_to:"auto", type:"dhiraj"},//here it is
    {name:"time", height:72, type:"time", map_to:"auto"}
];

//init scheduler after control is defined
scheduler.init('scheduler_here',new Date(),"week");

新しい入力は、定義に見られるように、 ' txt1 ' および ' txt2 ' プロパティの値を表示します。変更が保存されると、コンポーネントはすべてのイベント値をサーバーに送信します。カスタム値も送信されます。

サーバー側で更新を処理する方法に応じて、カスタム フィールドをdhtmlxConnectorの構成に追加するか、GET/POST パラメーターから取得する必要があります。

http://docs.dhtmlx.com/scheduler/lightbox_editors.html http://docs.dhtmlx.com/scheduler/custom_lightbox_editor.html

于 2014-01-26T10:55:28.180 に答える