[英]How to use jquery on click function in angular 2
最近,我在我的角度項目中使用了jqwidgets
即grid。 在這里,我只是在每個應單擊的單元格中放置了一個編輯,應將其重定向到編輯屏幕。
我嘗試了以下方式:
情況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
}
];
嘗試
<a [routerLink]="['./SomewhereElse']">Edit</a>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.