2017-04-21 12 views
0

私はuiグリッドセルにtimepickerを表示する必要があります。私はそれを実装しましたが、問題があります。それは上部のセルでうまく動作しますが、下部のセルでは、タイムピッカーの一部がグリッドの後ろに隠れています。ここにはプランカがあります。ブートストラップtimepickerがグリッドの背後に隠れている、Angular Js

http://plnkr.co/edit/YbZbboMz36xTCdikNyhN?p=previewenter code here

最後から二番目の行のCELL3をダブルクリックします。編集可能なセルテンプレートが開きます。タイマーアイコンをクリックします。時間ピッカーが開きます。しかし、それは下部がグリッドの後ろに隠れています。

答えて

0

私は、問題は、あなたがこの建設ということで、以下を参照してください

$(function() { 

      $('#timepicker').datetimepicker({ 
       //format: 'LT' 
       format: 'HH:mm' 
      }); 
}); 

あなたはすべての行に同じid #timepickerを持つ

ソリューション

はまた、我々はpositionを必要とする、ディレクティブを作成します。位置設定を保存するには、$last要素がある場合、垂直位置を上に切り替える必要があります。

app.directive('timeControl', [function(){ 

    return { 
    restriction: 'A', 
    link: function(scope, elem, attr) { 

    var position = { 
     horizontal: 'right', 
     vertical: 'bottom' 
    } 

    if(scope.$last === true) { 
     position = { 
     horizontal: 'right', 
     vertical: 'top' 
    } 
    } 

    elem.datetimepicker({ 
       //format: 'LT' 
       widgetPositioning: position, 
       widgetParent: elem, 
       format: 'HH:mm' 
      }); 



      elem.datetimepicker({ 
       //format: 'LT' 
       format: 'HH:mm' 
      }); 
    } 
} 

}]);

あなただけtime-control属性が<div class='input-group date">

Plnkrまたexample

screenshot

+0

こんにちはLeguestをDIVに追加

<form name="inputForm"> <div class='input-group date' time-control style="position:absolute; width: 80px;"> <input type='text' class="form-control" ng-class="col.colIndex()" ng-model="MODEL_COL_FIELD" style="height:28px"/> <span class="input-group-addon"> <span class="glyphicon glyphicon-time timer"></span> </span> </div> 

HTML。お返事をありがとうございます。実際に私のオリジナルコード$ lastはfalseとなり、$ middleは各行に当てはまります。あなたのプランナーでは、最初の行の時間ピッカーを確認すると、その行の先頭が現れ、今度は時刻ピッカーが一番上の行のグリッドの後ろに隠れているので、$行が各行に当てはまると思います。こんにちはレジェスト。 – MMM

+0

それを調べる機会はありましたか? – MMM

+0

そうだね。この問題を解決するには、データをui.gridに入れる前にマップする必要があります。こちらをご覧くださいhttp://stackoverflow.com/questions/29637188/how-to-get-row-index-in-angular-ui-grid-3-0。したがって、 'scope。$ last'を' currentRowIndex == $ scope.gridOpts.data.length - 1'に置き換える必要があります。 – Leguest

関連する問題