【问题标题】:ui-sref in ng-grid rowTemplateng-grid rowTemplate 中的 ui-sref
【发布时间】:2015-05-27 09:11:25
【问题描述】:

我已经在 cellTemplate 中使用了 ui-sref

getIndexDynamicColumnDefs: (data) ->
  sref = "stage.one({action: 'edit', id: {{row.getProperty('id')}}})"
  return [
    {field:'workable.user',displayName: 'Requesting User',cellFilter: 'camelize'}
    {field:'workable.requested_by',displayName: 'Requested_by',cellFilter: 'camelize'}
    {field:'workable.asset_type',displayName: 'Asset_type',cellFilter: 'camelize', cellTemplate: '<a ui-sref="' + sref+ '\"> ' + '{{row.getProperty(col.field)}}</a> '}
    {field:'workable.comments',displayName: 'Comments',cellFilter: 'camelize'}
    {field:'workable.created_at',displayName: 'Requested_on',cellFilter: "date:\'dd-MM-yyyy -- HH:mm \'" }]

它工作.. 是否可以在 ng-grid rowTemplate 中使用 ui-sref? 我真正想要的是,当我单击 ng-grid 中的一行时,我想重定向到另一个页面。 但是当我尝试将它用于 rowTemplate 时,我不知道该怎么做.. 希望你有一些想法!!!!

【问题讨论】:

    标签: angularjs ng-grid ui-sref


    【解决方案1】:

    在我在问题中发布的代码中,有以下几行

    {field:'workable.asset_type',displayName: 'Asset_type',cellFilter: 'camelize', cellTemplate: '<a ui-sref="' + sref+ '\"> ' + '{{row.getProperty(col.field)}}</a> '}
    

    它使锚标记中的值成为可点击的..我希望整个部门都是可点击的..所以我将其更改为

    {field:'workable.asset_type',displayName: 'Asset_type',cellFilter: 'camelize', cellTemplate: '<div ui-sref="' + sref+ '\"> ' + '{{row.getProperty(col.field)}}</div> '}
    

    使 div 中的整个单元格可点击。为了使整行可点击,我为所有字段提供了相同的 cellTemplate,最后使整行可点击

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-28
      • 1970-01-01
      • 1970-01-01
      • 2015-07-04
      • 2015-10-30
      相关资源
      最近更新 更多