2016-10-26 6 views
0

私は剣道のグリッドがjavascriptで生成されています。私はデータがページ上にあるので、私はデータソースがありません、その後、JavaScriptは、グリッドを生成します。私はタイプDateとしてカラムを設定しようとしていますが、カラムを空にすると表示されます。 JavaScriptの剣道グリッドのデータとして列の種類を設定します

これはIタイプを設定する場合PunchDay列が空表示されている剣道グリッド

var grid = $("#punches").kendoGrid({ 
     dataSource: { 
      pageSize: 15, 
      schema: { 
       model: { 
        fields: { 
         PunchDay: { type: 'date' } 
        } 
       } 
      } 
     }, 
     sortable: true, 
     selectable: "multiple", 
     pageable: true, 
     filterable: true, 
     scrollable: false, 
     groupable: true, 
     resizable: true 
    }).data("kendoGrid"); 

を生成するスクリプトです。私はそれがその文字列ではなく、日付の書式ので、この

@FieldTranslation.ToShortDate(Html.DisplayFor(modelItem => item.PunchDay).ToString())

のように設定され、その列のデータとは何かを持っていると信じています。しかし、私はこれを回避する方法はありません。私のグリッドコードは、私は私の日付が再表示されるために得るために何ができるか

<table class="table" id="punches"> 
 
      <thead> 
 
      <tr> 
 
       <th title="@FieldTranslation.GetLabel("ID", GlobalVariables.LanguageID)"> 
 
        @FieldTranslation.GetLabel("ID", GlobalVariables.LanguageID) 
 
       </th> 
 
       <th title="@FieldTranslation.GetLabel("EmployeeName", GlobalVariables.LanguageID)"> 
 
        @FieldTranslation.GetLabel("EmployeeName", GlobalVariables.LanguageID) 
 
       </th> 
 
       <th title="@FieldTranslation.GetLabel("PunchDay", GlobalVariables.LanguageID)"> 
 
        @FieldTranslation.GetLabel("PunchDay", GlobalVariables.LanguageID) 
 
       </th> 
 
       <th title="@FieldTranslation.GetLabel("PunchIn", GlobalVariables.LanguageID)"> 
 
        @FieldTranslation.GetLabel("PunchIn", GlobalVariables.LanguageID) 
 
       </th> 
 
       <th title="@FieldTranslation.GetLabel("PunchOut", GlobalVariables.LanguageID)"> 
 
        @FieldTranslation.GetLabel("PunchOut", GlobalVariables.LanguageID) 
 
       </th> 
 
       <th title="@FieldTranslation.GetLabel("Adjustment Time", GlobalVariables.LanguageID)"> 
 
        @FieldTranslation.GetLabel("Adjustment Time", GlobalVariables.LanguageID) 
 
       </th> 
 
       <th title="@FieldTranslation.GetLabel("Adjustment Description", GlobalVariables.LanguageID)"> 
 
        @FieldTranslation.GetLabel("Adjustment Description", GlobalVariables.LanguageID) 
 
       </th> 
 
       <th title="@FieldTranslation.GetLabel("WorkHours", GlobalVariables.LanguageID)"> 
 
        @FieldTranslation.GetLabel("WorkHours", GlobalVariables.LanguageID) 
 
       </th> 
 
       @*<th> 
 
        @Html.DisplayNameFor(model => model.Inactive) 
 
       </th>*@ 
 
       <th title="@FieldTranslation.GetLabel("Department", GlobalVariables.LanguageID)"> 
 
        @FieldTranslation.GetLabel("Department", GlobalVariables.LanguageID) 
 
       </th> 
 
       <th width="125px;" class="hidden-filter">Actions</th> 
 
      </tr> 
 
      </thead> 
 

 
      <tbody> 
 
      @foreach (var item in Model) 
 
      { 
 
       <tr> 
 
        <td> 
 
         @Html.DisplayFor(modelItem => item.ID) 
 
        </td> 
 
        <td> 
 
         @Html.DisplayFor(modelItem => item.EmployeeName) 
 
        </td> 
 
        <td> 
 
         @FieldTranslation.ToShortDate(Html.DisplayFor(modelItem => item.PunchDay).ToString()) 
 
        </td> 
 
        <td> 
 
         @FieldTranslation.ToShortTime(Html.DisplayFor(modelItem => item.PunchIn).ToString()) 
 
        </td> 
 
        <td> 
 
         @FieldTranslation.ToShortTime(Html.DisplayFor(modelItem => item.PunchOut).ToString()) 
 
        </td> 
 
        <td> 
 
         @Html.DisplayFor(modelItem => item.AdjustTime) 
 
        </td> 
 
        <td> 
 
         @Html.DisplayFor(modelItem => item.AdjustDescr) 
 
        </td> 
 
        <td> 
 
         @Html.DisplayFor(modelItem => item.WorkHours) 
 
        </td> 
 
        @*<td> 
 
         @Html.DisplayFor(modelItem => item.Inactive) 
 
        </td>*@ 
 
        <td> 
 
         @Html.DisplayFor(modelItem => item.Department) 
 
        </td> 
 
        <td> 
 
         <a href="@Url.Action("EditTime", "TimePunches", new {id = item.ID, flt = ViewBag.FLT})" title="Edit"><i class="icon-edit fa fa-pencil fa-fw fa-lg"></i></a> 
 
         <a href="@Url.Action("PunchLogIndex", "TimePunches", new {id = item.ID, flt = ViewBag.FLT})" title="Punch Log"><i class="icon-purple fa fa-book fa-fw fa-lg"></i></a> 
 
         <a href="@Url.Action("PunchRequestIndex", "TimePunches", new { punchId = item.ID, flt = ViewBag.FLT })" title="See Change Request Log"><i class="icon-niagara fa fa-list fa-fw fa-lg"></i></a> 
 
         <a href="#" id="delete" data-id="@item.ID" data-client="@item.ClientID"><i class="icon-red fa fa-times fa-fw fa-lg"></i></a> 
 
        </td> 
 
       </tr> 
 
      } 
 
      </tbody> 
 
     </table>

のですか?

+0

あなたは文字列としてそれを維持し、列の一部を追加しようとしましたように一部の列を追加してみ? – Soham

+0

私はそれを試しました@sohamそしてそれはちょうどグリッドを破るようです。フィルタリングや何もしません。 – TheDizzle

答えて

0

この

var grid = $("#punches").kendoGrid({ 
    dataSource: { 
     pageSize: 15, 
     schema: { 
      model: { 
       fields: { 
        PunchDay: { type: 'date' } 
       } 
      } 
     } 
    }, 
    sortable: true, 
    selectable: "multiple", 
    pageable: true, 
    filterable: true, 
    scrollable: false, 
    groupable: true, 
    resizable: true 
}, 
columns: [ 
    { field: "PunchDay", title: "PunchDay", format: "{0:MM/dd/yyyy}" }, 
    ... 
]).data("kendoGrid"); 
+0

私はこれを試しました。何らかの奇妙な理由でグリッドが破損するだけです。フィルターや何もロードしません。 – TheDizzle

+0

@TheDizzleグリッドを壊さないでください。 '... 'の部分の代わりに列のすべてのフィールドを追加しましたか? – Soham

+0

すべての列を含める – TheDizzle

関連する問題