Angularjs 智能桌+;角js

Angularjs 智能桌+;角js,angularjs,smart-table,Angularjs,Smart Table,我使用Angular js向用户显示报告 现在,我想自定义表头,并希望在智能表头中有一个colspan 有人知道吗?有可能吗? 请分享示例,plunker如果有人根据您需要添加的文档实现了这一点: app.controller('basicsCtrl', ['$scope', function (scope) { scope.rowCollection = [ {firstName: 'Laurent', lastName: 'Renard', birthDate: ne

我使用Angular js向用户显示报告

现在,我想自定义表头,并希望在智能表头中有一个colspan

有人知道吗?有可能吗?
请分享示例,plunker如果有人根据您需要添加的文档实现了这一点:

app.controller('basicsCtrl', ['$scope', function (scope) {
    scope.rowCollection = [
        {firstName: 'Laurent', lastName: 'Renard', birthDate: new Date('1987-05-21'), balance: 102, email: 'whatever@gmail.com'},
        {firstName: 'Blandine', lastName: 'Faivre', birthDate: new Date('1987-04-25'), balance: -2323.22, email: 'oufblandou@gmail.com'},
        {firstName: 'Francoise', lastName: 'Frere', birthDate: new Date('1955-08-27'), balance: 42343, email: 'raymondef@gmail.com'}
    ];

    scope.columnCollection = [
        {label: 'First Name', map: 'firstName'},
        {label: 'same same but different', map: 'firstName'},
        {label: 'Last Name', map: 'lastName'}
    ];
}]);

您的columnCollection将根据映射调整标签。

您可以在cellTemplate attr中使用任何模板,我将名字和姓氏连接在一起

就像我用过的

 scope.columnCollection = [
                { label: 'Name', map: 'FirstName', validationAttrs: 'required', validationMsgs: '<span class="error" ng-show="smartTableValidForm.FirstName.$error.required">Required!</span>',cellTemplate:'<div class="name"><span>{{dataRow.FirstName +" "+dataRow.LastName}}</span><div>'}, //have whatever template you want and your custom css
                //{ label: 'Last Name', map: 'LastName' },
                { label: 'User Name', map: 'UserName', validationAttrs: 'required' },
                { label: 'Password', map: 'Password', noList: true, editType: 'password' },
                { label: 'Customer', map: 'CustId', optionsUrl: '/GetCusts', editType: 'radio' },
                { label: 'Role', map: 'RoleId', optionsUrl: '/GetRoles', editType: 'select', defaultTemplate: '<option value="" ng-hide="dataRow[column.map]">---</option>', validationAttrs: 'required', validationMsgs: '<span class="error" ng-show="smartTableValidForm.RoleId.$error.required">Required!</span>' }, // NOTE: small hack which enables defaultTemplate option :)
                { label: 'E-mail', editType: 'email', map: 'Email' },
                { label: 'Cell Phone', map: 'Mobilephone', noEdit: true, validationAttrs: 'required' },
                { label: 'Locked', map: 'IsLocked', cellTemplate: '<input disabled type="checkbox" name="{{column.map}}" ng-model="dataRow[column.map]">', editType: 'checkbox', noAdd: true }
            ];
scope.columnCollection=[
{label:'Name',map:'FirstName',validationAttrs:'required',validationMsgs:'required!',cellTemplate:“{{dataRow.FirstName+”“+dataRow.LastName}},//拥有所需的模板和自定义css
//{标签:'LastName',映射:'LastName'},
{label:'User Name',map:'UserName',validationAttrs:'required'},
{label:'Password',map:'Password',noList:true,editType:'Password'},
{label:'Customer',map:'CustId',optionsUrl:'/GetCusts',editType:'radio'},
{label:'Role',map:'RoleId',optionsUrl:'/GetRoles',editType:'select',defaultTemplate:'--',validationAttrs:'required',validationMsgs:'required!',//注意:启用defaultTemplate选项的小技巧:)
{标签:“电子邮件”,编辑类型:“电子邮件”,地图:“电子邮件”},
{标签:“手机”,地图:“手机”,noEdit:true,validationAttrs:“必需”},
{标签:'Locked',映射:'IsLocked',单元格模板:'',编辑类型:'checkbox',noAdd:true}
];
在css中,您可以自定义css

请看看这个


希望这能解决您的问题:)

为什么不与我们分享一个plunkr示例,我们可以帮助您实现您想要的…?@Nix plnkr.co/edit/xsJs8m?p=上面的plunkr预览已经有人创建了。在上面的示例中,我想要一个名为“NAME”的列其中包含colspan=2,在这些单元格中,将根据您的建议尝试存储名字和姓氏。但不起作用。它将重复该值,因为firstName映射共享您的一些代码,以便我们知道您从何处开始plnkr.co/edit/xsJs8m?p=上面的预览plunkr已由某人创建。根据您的建议,我已尝试在columnCollection范围变量中将LastName更改为firstName。但输出就像是将firstName列的值重复到lastName列,因为在lastName列映射属性中有相同的值“firstName”