I use JQuery version 1.8.4 and jquery-ui-1.9.2
I have this array:
window.mapData.Layers = [{id:1,Title:water}{id:2,Title:land}{id:4,Title:data}{id:1,Title:info}]
I try to create table with some text and two buttons.
Each row in table have to display title the property of object from Layers array
and two buttons edit and delete.Each button have to sent as parameter the id of the property to handler when it clicked.
Here is the code:
(function () {
var content = $('<table>')
$(window.mapData.Layers).each(function (i, j) {
content += '<tr><td>' + j.Title + '</td><td>' + $('<button/>')
.text('Edit').onClick('eventHandler').params('j.id') +'</td>'+'<td>'+$('<button/>').text('Delete').onClick('eventHandler').params('j.id')+'</td>'+'</td></tr>'})
$('#vectorLayerslist').append(content);
}())
Here is result that I get:
water [object Object] [object Object]
land [object Object] [object Object]
data [object Object] [object Object]
info [object Object] [object Object]
But it's not works.As you can see above it's generate only text but not buttons. Any idea why buttons not generated? If there is any more elegant way to achieve my task?