如何在角度2的点击功能上使用jquery

时间:2017-04-13 07:07:20

标签: jquery angular

最近我在角度项目中使用了jqwidgets,即网格。在这里,我只是在每个单元格中放置一个编辑,然后单击应该重定向到编辑屏幕。

我尝试了以下方式:

案例1:

var Action = function (row, columnfield, value, defaulthtml, columnproperties) {
    return '<button onClick="open()">EDIT</button>'
}

案例2:

var Action = function (row, columnfield, value, defaulthtml, columnproperties) {
    return '<button (Click)="open()">EDIT</button>'
}

案例3:

var Action = function (row, columnfield, value, defaulthtml, columnproperties) {
    return '<button routerLink="user/edit/value">EDIT</button>'
}

以上所有案件都失败了。谁能帮帮我吗。感谢。

我的组件,

var Action = function (row, columnfield, value, defaulthtml, columnproperties) {
    return '<button>EDIT</button>'
}

this.columns = [
    {
        text: 'S.No', columntype: 'textbox', filtertype: 'input', datafield: 'id', width: 50, cellsalign: 'center'
    },
    {
        text: 'FirstName', columntype: 'textbox', filtertype: 'input', datafield: 'first_name', width: 100
    },
    {
        text: 'LastName', columntype: 'textbox', filtertype: 'input', datafield: 'last_name', width: 100
    },
    {
        text: 'ServiceType', columntype: 'textbox', filtertype: 'input', datafield: 'servicetype', width: 50
    },
    {
        text: 'Gender', columntype: 'textbox', filtertype: 'input', datafield: 'gender', width: 50
    },
    {
        text: 'DateofBirth', columntype: 'textbox', filtertype: 'input', datafield: 'birthday', width: 100
    },
    {
        text: 'Location', columntype: 'textbox', filtertype: 'input', datafield: 'formatted_address', width: 215
    },
    {
        text: 'AdultContentPrivay', columntype: 'textbox', filtertype: 'input', datafield: 'display_adult_content', width: 100
    },
    {
        text: 'LoginType', columntype: 'textbox', filtertype: 'input', datafield: 'logintype', width: 100
    },

    {
        text: 'Groups', columntype: 'textbox', filtertype: 'input', datafield: 'groups_count', width: 100
    },
    {
        text: 'Events', columntype: 'textbox', datafield: 'events_count', width: 100
    },
    {
        text: 'Albums', columntype: 'textbox', datafield: 'albums_count', width: 100
    },
    {
        text: 'Photos', columntype: 'textbox', width: 100
    },
    {
        text: 'Actions', columntype: 'dropdownlist', cellsrenderer: Action, width: 100, filterable: false
    },

    {
        text: 'More', columntype: 'dropdownlist', cellsrenderer: More, width: 100, filterable: false
    }
];

1 个答案:

答案 0 :(得分:0)

尝试

<a [routerLink]="['./SomewhereElse']">Edit</a>