GeeCON Prague 2014*
The moose likes JSF and the fly likes Delete an empty row from datatable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "Delete an empty row from datatable" Watch "Delete an empty row from datatable" New topic
Author

Delete an empty row from datatable

tech shine
Greenhorn

Joined: Aug 10, 2009
Posts: 1
Hi All ,

Iam experiencing an starange behaviour using jsf or tohawk datatable . I have an 'add' button which on click will add a new row with 5 columns (h:inputtext / tr:input text) to the datatable. I also have a delete button next to the added row. When i click on delete on the newly added row , the row gets deleted but is effecting the previously added row . To be more specific , the previously added row which is saved in db , is being shown as first row but with its h:inputtext fields as empty .

iam binding datatable to jsp in teh following way :

<t:dataTable var="RefTable" align="center"
value="#{Ref.RefLayoutList}"
rendered="#{not empty Ref.RefLayoutList}"
binding="#{Ref.RefDataTable}" cellpadding="1"
cellspacing="0" border="1" headerClass="dataTableHeader"
styleClass="dataTableFrame" columnClasses="align" rows="#{Ref.rows}" id="dataTbl">

<h:commandButton action="#{Ref.delete}" type="image"
image="design/images/content/delete.gif" immediate="true">
</h:commandButton>

in my BackingBean :


/**
public String delete() {

Object obj = RefDataTable.getRowData();


int index = RefDataTable.getRowIndex();



getRefLayoutList().remove(obj);




}

}

return null;
}


Is anything wrong with the above code ?





 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Delete an empty row from datatable