2014-01-15 2 views
0

팝업 편집기로 레코드를 만들 때 문제가 있습니다. 모델에서 [0] 모델이 잘못되었습니다. (아마도 getdata의 첫 번째 행) 모델 [1]이 괜찮습니다.kendoui 스케줄러에 중복 레코드 삽입

조치에 문제가 없지만 두 가지로 호출됩니다. 배열 모델에 기록하십시오. 어떻게하면 팝업에서 레코드 만 보낼 수 있습니까?

내 코드 :

<?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> 

들으 줄리오

답변

0

당신은 DataSource에의 batch 옵션을 사용할 수 없습니다.