jQWidgets Forums
jQuery UI Widgets › Forums › Plugins › AngularJS › function is not getting called in jqxgrid
This topic contains 3 replies, has 2 voices, and was last updated by Peter Stoev 10 years, 6 months ago.
-
Author
-
Hi,
I am trying to call the function by using ng-click in anchor tag. but it is not getting called in jqxgrid.
<body ng-app="gridFieldApp" ng-controller="gridFieldController"> <div> <jqx-grid style="width:500px;" id="sampleGrid" jqx-source=data1 jqx-data="dataObj"></jqx-grid> </div> <div> <fieldset style="width:500px;margin-top: 10px;"> <legend>Add</legend> <div> <table> <tr> <td> <label>Column Name:</label> <input type="text" ng-model="newItem.cloumn1" name="textbox" style="border-radius: 5px;"></input> </td> </tr> </table> <table> <tr> <td> <div> <jqx-button class="btn" jqx-width="70" jqx-height="20" style="float: right;margin-left: 50px;border-radius: 5px;" ng-click="addItems()"> Apply</jqx-button> </div> </td> </tr> </table> </div> </fieldset> </div> </body>
var appModule=angular.module("gridFieldApp",["jqwidgets"]); appModule.controller("gridFieldController",function($scope){ $scope.data1 = [{'cloumn1':'Column'}]; $scope.addItems = function(){ $scope.data1.push($scope.newItem); $scope.newItem = {}; $scope.CurrencyPair=""; }; $scope.gridSource = { localdata : $scope.data1, datafields: [ { name: 'cloumn1', type: 'string' } ], datatype : "JSON" }; $scope.gridDataAdapter = new $.jqx.dataAdapter($scope.gridSource); var linkrenderer = function (row, column, value) { var html = "<a href='' ng-click='callDelete()'>D</a>"; return html; }; $scope.ondelete = function(){ alert("On Delete"); console.log("delete"); }; $('#sampleGrid').jqxGrid({ source : $scope.gridDataAdapter, altrows:true, columns : [ { text : 'column 1', datafield : 'cloumn1', width : 100 }, { text : 'Actions', cellsrenderer: linkrenderer , width : 100 } ] }); });
Hi karthick singh,
The Grid’s custom rendering functions expect only HTML as a return value. It’s not possible to put widgets or compile html in the Grid’s cells.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Thanks for the reply. I want to call a function, when I click a link (or button) in Grid cell value.
Hi karthick singh,
Ok, but this can’t happen in the way you want to do it. You may look at the Mobile Demos about jqxGrid where this is demonstrated. Also please, write from 1 account, at present, you are writing from 4 accounts and that is definitely not fair and not professional.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.