s.s*_*mar 1 date angularjs angular-ui-grid datefilter
我想使用角度ui日期过滤器在搜索列中搜索日期。
当我尝试在列中搜索我的日期时,它没有显示正确的日期。我希望它显示用户搜索的完全匹配。示例:如果用户键入22-aug-16,则应仅显示与此日期匹配的日期,假设用户仅键入25-aug,则应仅显示与数据库中存在的任何年份的8月25日匹配的日期。
我尝试使用我的代码,例如
.controller(
'BlockADetailsController',
[
'$scope', '$rootScope','$location','$routeParams', '$filter', 'CommonService', 'BlockADetailsService', '$q',
function($scope, $rootScope,$location, $routeParams, $filter, CommonService, BlockADetailsService, $q) {
$scope.changeActorGridOptions = {
enableFiltering : true,
columnDefs : [
{
{
name : 'lLDate',
field : 'lLDate',
displayName : 'LAST_LOGIN',
width : '100',
minWidth: '90',
cellTemplate : '<div title="{{COL_FIELD | date:\'dd-MMM-yy\' }}">{{COL_FIELD | date:"dd-MMM-yy" }}</div>',
headerTooltip : true,
cellClass : function(grid, row,
col, rowRenderIndex,
colRenderIndex) {
return 'gridGroupCell';
},
headerCellFilter : 'translate',
},
Run Code Online (Sandbox Code Playgroud)
在这里我也尝试过
type: 'date'
Run Code Online (Sandbox Code Playgroud)
并且还添加了在stackoverflow中同类问题中提到的onselect函数。
喜欢,
onSelect: function(date){
scope.$apply(function() {
ngModel.$setViewValue(date);
});
}
Run Code Online (Sandbox Code Playgroud)
请帮助我,希望我能解释我的要求。请为此提供一些帮助。
这是我正在搜索的列字段,
这对我有用
{
name : 'lLDate',
field : 'lLDate',
displayName : 'LAST_LOGIN',
type : 'date',
cellFilter : 'date:"dd-MMM-yy"',
filterCellFiltered : 'true',
width : '100',
minWidth: '90',
cellTemplate : '<div title="{{COL_FIELD | date:\'dd-MMM-yy\' }}">{{COL_FIELD | date:"dd-MMM-yy" }}</div>',
headerTooltip : true,
cellClass : function(grid, row,
col, rowRenderIndex,
colRenderIndex) {
return 'gridGroupCell';
},
headerCellFilter : 'translate',
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5926 次 |
| 最近记录: |