Bootstrap Glyphicons datetimepicker更改图标

时间:2016-07-22 06:05:17

标签: jquery icons glyphicons bootstrap-datetimepicker eonasdan-datetimepicker

我正在使用Bootstrap datetimepicker https://eonasdan.github.io/bootstrap-datetimepicker/

如文件中所述,我成功地使用下面的代码更改了向上和向下箭头。

$('#datetimepicker7').datetimepicker({
    sideBySide: true,
    icons: {
        up: "fa fa-chevron-circle-up",
        down: "fa fa-chevron-circle-down",
    }
});

我可以知道如何更改日历的左右图标吗?为了便于理解,我在下面的图像中突出显示了要更改的图标。

Bootstrap Glyphicons image

任何帮助都将受到高度赞赏。

2 个答案:

答案 0 :(得分:11)

要更改左右图标,您只需更改以下代码:

icons: {
        time: 'glyphicon glyphicon-time',
        date: 'glyphicon glyphicon-calendar',
        up: 'glyphicon glyphicon-chevron-up',
        down: 'glyphicon glyphicon-chevron-down',
        //previous: 'glyphicon glyphicon-chevron-left',
        previous: 'glyphicon glyphicon-backward',
        next: 'glyphicon glyphicon-chevron-right',
        today: 'glyphicon glyphicon-screenshot',
        clear: 'glyphicon glyphicon-trash',
        close: 'glyphicon glyphicon-remove'
    },

默认情况下,我已评论该图标的行显示,如果您需要更改该图标,您只需设置路径或任何要显示的图标。

您可以参考以下链接:  https://eonasdan.github.io/bootstrap-datetimepicker/Options/

答案 1 :(得分:4)

您只需在previous中的next对象中插入icons$('#datetimepicker7').datetimepicker({ sideBySide: true, icons: { up: "fa fa-chevron-circle-up", down: "fa fa-chevron-circle-down", next: 'fa fa-chevron-circle-right', previous: 'fa fa-chevron-circle-left' } });个键,如docs中所述。

<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css" rel="stylesheet"/>
<link href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css" rel="stylesheet"/>

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>

<div class="form-group">
  <div class="input-group date" id="datetimepicker7">
    <input type="text" class="form-control" />
    <span class="input-group-addon"><span class="glyphicon-calendar glyphicon"></span></span>
  </div>
</div>
var entities = new List<User>();

entities.Add(new User { Name = "First", Type = "TypeA" });
entities.Add(new User { Name = "Second", Type = "TypeB" });

string[] columns = { "Name", "Type" };

var selectResult = new List<string>();

foreach (var columnID in columns)
{
    selectResult.AddRange(entities.Select(e => e.GetType().GetProperty(columnID).GetValue(e, null).ToString()));
}

foreach (var result in selectResult)
{
    Console.WriteLine(result);
}