2016-08-08 8 views
0

最後の列にボタンを追加して、onClick - > modal windowを作成しようとしています。ボタンがカスタムコマンド(剣道UI)を使用して列に追加されない

ボタンが

  • ブラウザはJSは私がプロジェクトに
  • を再構築しようとしました、それはVisualStudioを
  • のように同じであるファイルを見ている...新しい列だけでなく、表示されません
  • 改名JSファイル
  • リブート:)
  • ブラウザの検査官は私に発生した新たな 列が存在しないことを理解しています...

enter image description here

PLSは私に何が悪かったのかの手掛かりを与えますか?どうもありがとう!!!

$(document) 
.ready(function() { 


    //KendoGrid 
    var tabStrip; 
    var GridObject; 
    var expandedRowDataItem; 
    var accountInfoTabData; 
    var rowObject; 


    $("#grid") 
     .kendoGrid({ 
      dataSource: { 
       transport: { 
        read: { 
         url: "/api/GridData/GetCustomers", 
         dataType: "json" 
        } 
       }, 
       pageSize: 20, 
       schema: { 
        parse: function(response) { 

         $.each(response, 
          function(idx, elem) { 
           if (elem.RegistrationDate && typeof elem.RegistrationDate === "string") { 
            elem.RegistrationDate = kendo.parseDate(elem.RegistrationDate); 
           } 

           if (elem 
            .RemovalFromClientsDate && 
            typeof elem.RemovalFromClientsDate === "string") { 
            elem.RemovalFromClientsDate = kendo.parseDate(elem.RemovalFromClientsDate); 
           } 

          }); 
         return response; 
        } 
       } 
      }, 
      autoBind: true, 
      height: 550, 
      filterable: true, 
      groupable: true, 
      sortable: true, 
      //editable: "inline", 
      pageable: { 
       refresh: true, 
       pageSizes: true, 
       buttonCount: 5 
      }, 
      detailTemplate: kendo.template($("#template").html()), 
      detailInit: detailInit, 

      detailExpand: function(e) { 
       //this.collapseRow(this.tbody.find(" > tr.k-master-row").not(e.masterRow)); 
       expandedRowDataItem = this.dataItem(e.masterRow); 

      } 
     }, 
     { 
      columns: [ 
       { field: "UniqueClientCode", title: "Уникальный код клиента" }, 
       { field: "ClientName", title: "Имя клиента" }, 
       { field: "ClientOKPO", title: "ОКПО клиента" }, 
       { 
        field: "RegistrationDate", 
        title: "Дата регистрации", 
        type: "date", 
        format: "{0:dd/MM/yyyy}" 
       }, 
       { 
        field: "RemovalFromClientsDate", 
        title: "Дата удаления из клиентов", 
        type: "date" 
       }, 
       { 
        command: { text: "View Details", click: showDetails }, 
        title: "View DT", 
        width: "50px" 
       } 
      ] 
     }); 

     function showDetails(e) { 
     alert("view"); 
    } 
+0

私は、コマンドの正しい構文ではなく 'text'の' name'のを使用することだと思います。 あなたのケースでは、次のようなものがあります: '名前:「詳細を表示」をクリックしてください:showDetails}' – Philipp

+0

私は自分のドキュメントをダブルチェックしました。 私は現在あなたのコードをテストすることができませんが、私が家に帰るときには見ています。 – Philipp

+0

コンソールのエラーを確認しましたか?あなたのコードを[this dojo](http://dojo.telerik.com/IfONU)に貼り付けてもうまく動作します。 – DontVoteMeDown

答えて

0

最後の列 EDITとしてあなたの列定義の最後にこれを試してみてください(RAZOR):この質問を設定するための

columns.Template(p => { }).ClientTemplate("<button style='width: 20px;'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></button> <button style='width: 20px;'><i class='fa fa-trash' aria-hidden='true'></i></button>").Width(130).Title("Edit/Delete").HtmlAttributes(new { @class = "tdCenter" }); 
+0

それはかみそりの構文ですか?私はそれを実装する方法を知らない私のコードはjsファイル(jquery) –

0

申し訳ありません。問題は見つかった...そのことはとてもばかげている... "かっこ"。

セクションでは、個別の括弧の中にいた:

{ 
columns: [ 
/*some code*/ 
] 
} 

そして、何とかそれはボタンが付いた最後の列を除き、グリッド全体のために働きました。

そして、それはこの方法でなければなりません:

$("#grid") 
    .kendoGrid({ 
     dataSource: { 
/*DataSource*/ 
}, 
columns: [ /*some code*/ 
] 
}); 
関連する問題