0

ポップアップ エディターでレコードを作成するときに問題が発生します。アクション php でモデルに 2 つのレコードを受け取りました。モデル [0] は間違っています (おそらく getdata の最初の行) モデル [1] は問題ありません

アクションに問題はありませんが、配列モデルの 2 つのレコードで呼び出されます。ポップアップからレコードのみを送信するにはどうすればよいですか?

私のコード:

 <?include $BUCKER_FRAMEWORK_PATH."/INC/TOP_APPLET_JQ.php"; ?>
          <div id="example" class="k-content">
<div id="window"></div>
<div id="scheduler"></div>

  <script type="text/x-kendo-template" id="schedulerTemplate">

<div class="k-edit-label">
    <label for="start">Start</label>
</div>
<div class="k-edit-field" data-container-for="start">
    <input data-role="datetimepicker" name="start" />
</div>
<div class="k-edit-label">
    <label for="end">End</label>
</div>
<div class="k-edit-field" data-container-for="end">
    <input data-role="datetimepicker" name="end" /></div>

<div>
 <div class="k-edit-label">
    <label for="title">Descrizione</label>
</div>  
<div class="k-edit-field" data-container-for="title">
    <textarea class="k-textbox" name="description" data-bind="value:description" required ></textarea>
</div>
<div class="k-edit-label">
    <label for="cliente">Cliente</label>
</div>
<div class="k-edit-field" data-container-for="cliente">
<input type="hidden" id="oldedtACCOUNT_NAME" name="oldedtACCOUNT_NAME" data-bind="value:accountname" />
<input  type="hidden" name="accountid" id="accountid" data-bind="value:accountid"/>
   <input class="inputboxPick" readonly type="text"  SIZE="25"  name="tmpACCOUNT_NAME"  id="tmpACCOUNT_NAME" data-bind="value:accountname" />
   <a id="href_kendoPickApplet" class="ui-button ui-widget ui-state-default ui-button-text-only"  href="\#" 
    onclick="KendoPickApplet('?module=accounts&applettype=pickapplet&CODICE=accountid&VALORE=tmpACCOUNT_NAME&addConstrain=&mode=action');return false;">
    <i class="icon-external-link"></i>
    <a id="cancel_ACCOUNT_NAME" class="ui-button ui-widget ui-state-default ui-button-text-only" href="\#" onclick="javascript:$('\#edtACCOUNT_ID').val('');javascript:$('\#tmpACCOUNT_NAME').val('');return false;">
    <i class="icon-remove"></i>    
    </a>

</div>
<!--
<div class="k-edit-label">
    <label for="type">Type</label>
</div>
<div class="k-edit-field" data-container-for="type">
    <input data-role="dropdownlist" id="type" data-bind='value:type' data-text-field='text' data-value-field='value' data-bind="source: dataSource2"/>
</div>
-->
<div class="k-edit-label">
    <label for="type2">Type</label>
</div>
<div class="k-edit-field" data-container-for="type">
    <input data-role="dropdownlist" id="type" data-bind='value:type' />
</div>
<script>
    $("\#type").kendoDropDownList({
        dataTextField: "text",
        dataValueField: "value",
        optionLabel: " ",
        //value:theId,
        dataSource: {
            transport: {
                read: {
                    dataType: "json",
                    url: "fetchj.php?type=PCK_EVENT",
                }
            }
        }
    });
<\/script>    
</div>

</script>



<script>

function onRequestEnd(e) {

    if (e.type == "create" || e.type == "update") {
        //check for errors in the response

        if (e.response.Esito=="OK") {
            setTimeout(function() {
                $.bootstrapGrowl(e.type+" record OK", {
                    type: 'success',
                    align: 'center',
                    offset: {from: 'top', amount: 2},
                    width: 'auto',
                    allow_dismiss: true
                   });

            })  
        } else {
           setTimeout(function() {
                //alert("error");
                $.bootstrapGrowl(e.response.Esito, {
                    type: 'danger',
                    align: 'center',
                    offset: {from: 'top', amount: 2},
                    width: 'auto',
                    allow_dismiss: true
                   });
            });
        }
        this.read();
    }
};  



$(function() {

var dataSource2 = new kendo.data.DataSource({
  transport: {
    read: {
      //url: "http://demos.kendoui.com/service/products",
      url: "fetchj.php?type=PCK_EVENT",
      dataType: "json"
    }
  }
});
    $("#scheduler").kendoScheduler({
        height: 600,
        editable: {
            template: kendo.template($("#schedulerTemplate").html())
        },

        views: [
            "day",
            "week",
            { type: "month", selected: true },
            "agenda"
        ],
        timezone: "Etc/UTC",
        dataSource: {
            transport: {
                read: { 
                    url: "?module=calendarskendo&applettype=server_cal&mode=action&action=getData",                    
                    dataType: "json"
                },
                update: {
                    url: "?module=calendarskendo&applettype=server_cal&mode=action&action=update",                    
                    dataType: "json"
                },
                create: {
                    url: "?module=calendarskendo&applettype=server_create&mode=action&action=create",                    
                    dataType: "json"

                },
                destroy: {
                    url: "http://demos.kendoui.com/service/meetings/destroy",
                    dataType: "jsonp"
                },

                /*
                parameterMap: function(options, operation) {
                    if (operation !== "read" && options.models) {
                        return {models: kendo.stringify(options.models)};
                    }
                }
                */
            },
            autoSync: false,
            batch: true,
            requestEnd: onRequestEnd,
            schema: {
                //data: "data",
                //total: "total",



                model: {
                    fields: {
                      id: { from: "TaskID" ,type: "text"},
                      phone : { from: "Phone" },
                      accountname : { from: "Accountname" },
                      accountid : { from: "Accountid" },
                      title: { from: "Title" },
                      type: { from: "Type" },                      
                      description: { from: "Description" },
                      start: { from: "Start", type: "date", format: "{0:yyyy-MM-dd}"},
                      end: { from: "End", type: "date", format: "{0:yyyy-MM-dd}"}
                    }
                }
            },

        },
    });
});


</script>
</div>

thxジュリオ

4

1 に答える 1

0

dataSource のバッチオプションは使用しないでください。

于 2014-01-15T14:58:56.717 に答える