zoukankan      html  css  js  c++  java
  • ui-grid从后端获取数据后更改数据显示的格式

    从后端获取的数据时是这样的:

    {
      "TotalCount":14,"Items":
      [
        {
          "ProfileId":14,
          "Name":"网站分析-测试3",
          "LastModifyTime":"2017-07-26T10:59:45.5433333",
          "PlanId":3733310,"BatchId":53,
            }
        ]
    }            

    想改变“时间的显示格式”和“为数字加上千位符号”,代码如下:

                  self.$scope.gridOptions.data = [];
                  self.analyzeService.getAnalyzeProfile(self.$scope.gridDataOption, self.$scope.onlyMine).then(function (res) {
                      let datas = res.Items;
                      self.$scope.gridOptions.data = _.map(datas, item => {
                          item.CrawlCountShow = item.CrawlCount.toString().replace(/(d)(?=(d{3})+(?!d))/g, '$1' +  ',')
                          item.LastModifyTime = self.formatDate(new Date(item.LastModifyTime));
                          return item;
                      });
                 });
  • 相关阅读:
    会场安排
    Comet OJ
    CodeForces1154F
    CodeForces1154E
    2019.08.25校内模拟赛Graph
    2019.08.25校内模拟赛Page
    [MtOI2019]灵梦的计算器
    [MtOI2019]永夜的报应
    [NOI2018]归程
    USACO[CowCoupons]
  • 原文地址:https://www.cnblogs.com/XHappyness/p/7238596.html
Copyright © 2011-2022 走看看