2016-04-20 10 views
0

私は剣道グリッドを持っています。その上で行を更新または削除できます。しかし、問題は私が剣道のグリッドを更新した直後、または行を取り除くことができないことです。しかし、それをリロードするためにf5を押すとうまくいきます。私はそれが動作しない多くの方法を試してみました。更新または削除後に剣道グリッドを再ロードできません。

$.post(LogstimeEditConstants.urlLogstimeEditRead, { projectId: projectid, userId: userid }, 
      function (result) { 
       objdata = eval(result.data); 
       defaultProjectId = result.defaultProjectId; 
      }); 
     var dslogstime = new kendo.data.DataSource({ 
      data: objdata, 
      schema: { 
       model: { 
        id: "Id", 
        fields: { 
         Id: { required: true }, 
         ProjectID: { defaultValue: defaultProjectId }, 
         WorkDate: { type: "date", defaultValue: dateselect }, 
         TaskId: { defaultValue: defaultTaskId }, 
         WorkHours: { type: "number", defaultValue: "0.5" }, 
         Description: {}, 
         IsDelete: { type: "boolean", defaultValue: false } 
        } 
       } 
      }, 
      sort: [{ field: "ProjectID", dir: "asc" }] 
     }); 
     timelogGrid = $("#tleditgrid").kendoGrid({ 
      dataSource: dslogstime, 
      scrollable: true, 
      editable: "inline", 
    }); 

$("#savebutton").click(function (e){ 
// Remove Logstime 
     $.ajaxSetup({ async: false }); 
     for (var i = 0; i < deleteTimeLogsData.length; i++) { 
      if (deleteTimeLogsData[i].IsDelete === true) { 
       var timelogsId = deleteTimeLogsData[i].Id; 
       $.post(LogstimeEditConstants.urlLogstimeDelete, { logstimeId: timelogsId }, 
        function (result) { 
          $.post(LogstimeEditConstants.urlLogstimeEditRead, { editType: edittype, projectId: projectid, selectDay: selectday, selectMonth: selectmonth, userId: userid }, 
          function (result) { 
           objdata = eval(result.data); 
           defaultProjectId = result.defaultProjectId; 
          }); 
          timelogGrid.dataSource.read(); 
          timelogGrid.refresh(); 
         } 
        }); 
      } 
     } 
}); 

ご協力ありがとうございました。

答えて

0

はtimelogGrid.dataSource.data = objdataを再割り当てするための$ .post(LogstimeEditConstants、... にしてみてください。 リフレッシュ前 あなたは

timelogGrid応答内の次の2行を配置する必要がありますことを意味します。 .dataSource.read(); timelogGrid.refresh();

関連する問題