Open victorhazbun opened 9 years ago
I figured it out, this is the correct snippet to solve the initial issue:
<tr ng-repeat="door in doors">
<td>{{door.id}}</td>
<td>{{door.notes}}</td>
<td>{{door.deleted_at}}</td>
</tr>
Anyway I have another problem, the table says "No results found!" PLEASE tell me how to use Angular ng-repeat so it displays the list.
https://www.evernote.com/l/AWhm9In4_WxMk5D9Q5zCoX51ygoD1EHVW_Q
I have figured out the "No results found!" by using the ajax feature like this:
.directive('bootgridCommand', function($timeout) {
return {
restrict: 'A',
link: function(scope, element, attr) {
$timeout(function(){
element.bootgrid({
ajaxSettings: {
method: "GET",
cache: true
},
ajax: true,
url: scope.$eval(attr.apiUrl),
css: {
icon: 'md icon',
iconColumns: 'md-view-module',
iconDown: 'md-expand-more',
iconRefresh: 'md-refresh',
iconUp: 'md-expand-less'
},
formatters: {
"active": function(column, row) {
return row.deleted_at == "0" ? "Yes" : "No";
},
"commands": function(column, row) {
return "<button ng-click=\"alertme()\" type=\"button\" class=\"btn btn-icon command-edit\" data-row-id=\"" + row.id + "\"><span class=\"md md-check c-green\"></span></button>" +
"<button type=\"button\" class=\"btn btn-icon command-delete\" data-row-id=\"" + row.id + "\"><span class=\"md md-close c-red\"></span></button>";
}
}
});
});
}
}
})
My HTML:
<table class="table table-striped table-vmiddle" bootgrid-command api-url="apiUrl">
<thead>
<tr>
<th data-column-id="id" data-type="numeric" data-identifier="true">ID</th>
<th data-column-id="notes">Notes</th>
<th data-column-id="deleted_at" data-formatter="active">Active</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">Commands</th>
</tr>
</thead>
</table>
The last problem I found is that ng-click does not trigger when I use the table command buttons. Any ideas?
There are some ways to solve this.
element.bootgrid({
//Your content
}).on("loaded.rs.jquery.bootgrid", function()
{
/* Executes after data is loaded and rendered */
grid.find(".command-edit").on("click", function(e)
{
alert("You pressed edit on row: " + $(this).data("row-id"));
}).end().find(".command-delete").on("click", function(e)
{
alert("You pressed delete on row: " + $(this).data("row-id"));
});
});
Hello guys, I'm using AngularJs 1.4.0 and jquery.bootgrid 1.3.1. The problem I have is that I'm trying to display a collection of objects into the tbody but I get an un-expected result. This is how it looks https://www.evernote.com/l/AWh6DotIKwJNFKr7FrRNOpftzm_9iha_jqc
Please tell me what I'm doing wrong or how I can use the jquery-bootgrid plugin correctly. Thanks!!!
This is the Angular directive I'm using:
This is the table HTML:
And this is my controller JS: