2017-04-13 10 views
0

最近私の角プロジェクトではjqwidgetsすなわちグリッドを使用しました。ここでは、クリックした各セルに編集を入れて、編集画面にリダイレクトする必要があります。角2のクリック機能でjqueryを使用する方法

私は、次の方法で試してみました:

ケース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>' 
} 

上記のすべてのケースに失敗しました。誰でも助けてくれますか?ありがとう。あなたはjQueryのために行くか、なぜあなたはネイティブangular2でのプラグインの多くを持っているとき

私のコンポーネント、

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の世界から出てきてください。代わりに[** this **](https://www.primefaces.org/primeng/#/datatable)を使用してください – Aravind

+0

こんにちはAravind、これはかなり良く見え、角度2でこれを作成したいと思います。 – MMR

+0

私はあなたを得ません。 – Aravind

答えて

0

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

HI Ramya、これはjquery [routerLink]が動作していないためです。 – MMR

+0

なぜルータリンクは動作しませんか?それは角度成分の中に書かれていますか? – RemyaJ

関連する問題