jsf - Add Dynamic Row in <p:datatable> Using <p:commandButto> and <f:ajax> -
The command button in the following code does not work properly for the dataset.
& lt; P: datatable id = "invoitable" var = "ipsDetail" value = "# {invoiceBean.ipsDetails}" border = "1" & gt; & Lt; P: column header text = "senior number" & gt; & Lt; H: Input text id = "serialN7umber" value = "# {ipsDetail.serialNumber}" size = "3" /> & Lt; / P: column & gt; & Lt; P: column headerText = "luggage details" & gt; & Lt; P: inputtext value = "# {ipsDetail.descriptionOfGoodsOrService}" /> & Lt; / P: column & gt; & Lt; P: column header text = "hsn code" & gt; & Lt; P: inputtext value = "# {ipsDetail.hsnCode}" style class = "alignment" /> & Lt; / P: column & gt; & Lt; P: column header = "volume" & gt; & Lt; P: inputtext value = "# {ipsDetail.quantity}" styleClass = "Alingment" /> & Lt; / P: column & gt; & Lt; P: column header = print = "rate" & gt; & Lt; P: input text = "# {ipsDetail.rate}" styleClass = "Alingment" /> & Lt; / P: column & gt; & Lt; P: column headerText = "percent discount" & gt; & Lt; P: inputtext value = "hello" is provided = "# {ipsDetail.percentDiscount}" styleClass = "Alingment" /> & Lt; / P: column & gt; & Lt; P: column header text = "zodiac" & gt; & Lt; P: inputtext value = "# {invoiceBean.amount}" style class = "alignment" /> & Lt; / P: column & gt; & Lt; F: aspect names = "footer" & gt; & Lt; P: command button value = "add new line" action = "# {invoiceBean.addRow}" update = ": form: invoicetable" & gt; & Lt ;! - & lt; F: Ajax execution = ": form: invoicetable" render = ": invoicetable: add column" /> - & gt; & Lt; / P: CommandButton & gt; & Lt; / Ch: Aspect & gt; & Lt; / P: DataTable & gt; & Lt; / H: form & gt;
I would like to add a dynamic row with inputtext, in which the prefetch command button is in Java. It works, but it is not possible to re-submit.
Public class invoice bean implies serializable {
public list getInvoices () {
Invoicedao invoice = new invoice dao (); Invoice = InvoiceAdobe.Get InvaData (); Return invoice; } Public Zero Set Invoice (List & Lt; Invoice> Invoice) {If (Invoice! = Null) {this.invoices.add (New Invoice ()); }} Public Zero Invoice Data () {InvoiceDownOvoice = new invoices (); IpsDetail = New Invoice Products Services Details (); If (ipsDetail! = Null) {ipsDetail .setDescriptionOfGoodsOrService (descriptionOfGoodsOrService); IpsDetail.setHsnCode (hsnCode); IpsDetail.setInvoiceId (invoice.getId ()); IpsDetail.setPercentDiscount (percentDiscount); IpsDetail.setQuantity (Quantity); IpsDetail.setRate (rate); IpsDetail.setSerialNumber (serialnumber); IpsDetail.setServiceTax ((float) 12.5); IpsDetail.setVat (5); Println ("InvoiceBean.insertInvoice"); } InvoiceDo.Instor invoice (invoice, ASPDTET); } Public row addRow () {line line = new line (); InputText input text = new input text (); InputText.setSubmittedValue ("hello"); Column column = new column (); Row.setParent (inputText); Column.setHeader (inputText); Column.setHeaderText ("hearty"); Return line; }
} This is the code for the row or column with the input row
Since you are using primers, you can update any component manually by ManagedBean using the org.primefaces.context.RequestContext
object.
For example:
Face:
& lt; H: form id = "form1" & gt; & Lt; P: DataTable id = "myTab" & gt; ... & lt; / P: Datatable & gt; & Lt; / H: form & gt;
Managed Bean:
Request Context ReqCtx = Requestcontext.getCurrentInstance (); Req.Ctx.update ("Form1: myTab");
Comments
Post a Comment