I would like to have a JSF data table and insert rows (with input fields) into the table as I click a button. In JS one would think of doing something like:
$(document).ready(function(){
$('#myButton').click(function(){
document.getElementById('myTable').style.display="block"; //show table
var table = document.getElementById("myTable"); //get table
var row = table.insertRow(1); //insert row into table
var cell1 = row.insertCell(0); //insert into the created row
var cell2 = row.insertCell(1); //insert into the created row
cell1.innerHTML = "<input type='text' value='someValue' readonly='readonly'>";
cell2.innerHTML = '<textarea rows="1" cols="90" ></textarea>';
});
});
I am developing a java web application in which one of the screens will have a user click a button to have more input fields. Any suggestion how to do this in maybe primefaces? I am not very conversant with JSF yet. Any help will be appreciated.