-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
renderWith with data object in ng-click #145
Comments
If you look at the result DOM (with your browser inspector), you should see something like So, put directly your wanted data in the parameter instead of the entire data object. For example: .renderWith(function(data) {
return '<button ng-click="selectItem(' + data.id + ', ' + data.firstName + ')">' +
'Select item' +
'</button>';
}); |
Thank for response |
hello, Kristi |
But how to define data in the $scope variable.. I'm unable to pass data as an object in ng-click. |
You can't right now. Related to #299. |
Okay I managed it somehow... now the next thing is like i have two api calls for fetching data and show in datatable... |
Ok, I managed somehow to pass an object in the In my example, I set a temp variable vm.persons = {};
...
function edit(person) {
...
}
function delete(person) {
...
}
function createdRow(row, data, dataIndex) {
// Recompiling so we can bind Angular directive to the DT
$compile(angular.element(row).contents())($scope);
}
function actionsHtml(data, type, full, meta) {
vm.persons[data.id] = data;
return '<button class="btn btn-warning"' +
' ng-click="showCase.edit(showCase.persons[' + data.id + '])">' +
' <i class="fa fa-edit"></i>' +
'</button> ' +
'<button class="btn btn-danger"' +
' ng-click="showCase.delete(showCase.persons[' + data.id + '])")">' +
' <i class="fa fa-trash-o"></i>' +
'</button>';
} |
I'm currently changing datatables built with angular html code to use server-side processing and this was very helpful. I would suggest including the Binding Angular directive to the DataTable link on the Server side processing page. |
New link for bind Angular Directive to the DataTable |
Hello,
I want to use with renderWith ng-click on a function. I followed your example. It works.
However, I need to spend all my data object in my function, because is a restangular object. Only I have this error:
Syntax Error: Token 'Object' is at column {2} of the term [{3}] starting at [{4}].
My code :
button class=btn btn-warning ng-click=selectItem(data)>
Thank you in advance for your info.
Kristi
The text was updated successfully, but these errors were encountered: