2017-04-13 65 views
0

最近我在我的角度项目中使用了jqwidgets即网格。在这里,我只是把一个编辑放在每个单元格中,点击它应该重定向到编辑屏幕。如何使用jquery的角度2中的点击功能

我试图在以下几个方面:

案例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 
    } 
]; 
+0

。走出这个jQuery世界。使用[**这**](https://www.primefaces.org/primeng/#/datatable)而不是 – Aravind

+0

嗨Aravind,这看起来好多了,并希望在角2创建此。 – MMR

+0

我没有得到你。详细说明你的问题 – Aravind

回答

0

当你有很多的插件在本地angular2为什么你去jQuery的尝试

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

HI Ramya,因为这是在jQuery [routerLink]不起作用。 – MMR

+0

为什么路由器连接不工作?它是写在一个角度的组件里吗? – RemyaJ