2016-09-06 16 views
0

フィールドをname: "Name"に設定してrequiredと入力し、jsgridのドキュメント(http://js-grid.com/docs/#grid-fields)に従ってvalidate: "required"を挿入しましたが、機能しません。jsgridフィールドがダイアログ内で「必須」と表示されない

validate: "required"をjsgridフィールドの下のコードに挿入すると、Name jsgridは必要な制限とブロックの挿入を行いません! validateは、ダイアログとjsgridの両方で定義できるパラメータであるため、ダイアログ内にグリッドを囲んでいるという事実はほぼ確実です。

これはダイアログが表示され、ダイアログ内にグリッドが表示されますが、検証には「必須」を渡すことはできません。私はまた、アップロードされ、Grid inside dialogスクリーンショット:

$("#DataGrid").dialog({minWidth: 1000, minHeight: 500}); 
      $("#DataGrid").jsGrid({ 
        height: "100%", 
        width: "70%", 
        filtering: true, 
        editing: true, 
        inserting: true, 
        sorting: true, 
        paging: true, 
        autoload: true, 
        pageSize: 15, 
        pageButtonCount: 5, 
        datatype: "json", 
        deleteConfirm: "Do you really want to delete the client?", 
        controller: db, 
        fields: [ 
         { name: "Id", align: "center", width: 45 }, 
         { name: "Name", validate:"required," align: "center", type: "text", width: 45 }, 
         { name: "Displayed Name(locale)", align: "center", type: "text", width: 40 }, 
         { name: "Data Type", align: "center", type: "select", items: db.dataType, valueField: "Id", textField: "Name", width: 40 }, 
         { name: "Initial Value", align: "center", type: "text", width: 40 }, 
         { name: "Initial State", align: "center", type: "select", items: db.initialState, valueField: "Id", textField: "Name", width: 50 }, 
         { name: "Worklist Order", align: "center", type: "number", width: 20 }, 
         { name: "DB Datatype", align: "center", type: "text", width: 25 }, 
         { name: "Allowed Values JSON", align: "center", type: "text", width: 20 }, 
         { name: "Allowed Values SQL", align: "center", type: "text", width: 20 }, 
         { type: "control", width: 25 } 
        ] 

      }); 

私は、ダイアログなしでjsgridコードを試してみました、それが動作しますが、それはどのようにダイアログ内で動作しますか? ダイアログ作品なしのこのコード:

$("#DataGrid").jsGrid({ 
       height: "100%", 
       width: "70%", 
       filtering: true, 
       editing: true, 
       inserting: true, 
       sorting: true, 
       paging: true, 
       autoload: true, 
       pageSize: 15, 
       pageButtonCount: 5, 
       datatype: "json", 
       deleteConfirm: "Do you really want to delete the client?", 
       controller: db, 
       fields: [ 
        { name: "Id", align: "center", width: 45 }, 
        { name: "Name", validate:"required", align: "center", type: "text", width: 45 }, 
        { name: "Displayed Name(locale)", align: "center", type: "text", width: 40 }, 
        { name: "Data Type", align: "center", type: "select", items: db.dataType, valueField: "Id", textField: "Name", width: 40 }, 
        { name: "Initial Value", align: "center", type: "text", width: 40 }, 
        { name: "Initial State", align: "center", type: "select", items: db.initialState, valueField: "Id", textField: "Name", width: 50 }, 
        { name: "Worklist Order", align: "center", type: "number", width: 20 }, 
        { name: "DB Datatype", align: "center", type: "text", width: 25 }, 
        { name: "Allowed Values JSON", align: "center", type: "text", width: 20 }, 
        { name: "Allowed Values SQL", align: "center", type: "text", width: 20 }, 
        { type: "control", width: 25 } 
       ] 

     }); 

任意のアイデアしてください?それは複雑な問題です。

+1

ダイアログ内にグリッドを表示しようとしていますか?グリッドを別のdivで囲み、このラッパーのダイアログを初期化してみてください。 – tabalin

+0

@tabalin私は本当にあなたにします。聞いてください:1)私のグリッドと私のダイアログの両方が同じdivにラップされているとき、私のグリッドはダイアログ内に正常に表示されますが、グリッドの挿入アクションブロック以来渡すことができません(検証: "必須")。グリッドとダイアログを別のグリッドにラップすると、空のダイアログだけが表示されます。どうすればいいですか? –

+0

また、私のグリッド内のグリッドがhttp://i.stack.imgur.com/yLViN.pngにどのように表示されるかを示すスクリーンショットをアップロードしました。検証後にブロックを挿入することを覚えておいてください:「必須」 –

答えて

0

@ tabalinの助けてくれてありがとう、私は問題を解決しました。私は1つ少ないjsgridアーカイブを持っていました。今それは魅​​力のように動作します!

関連する問題