-
1. Re: how to delete selected record using modalPanel?
djo.mos Dec 7, 2007 4:48 AM (in response to panky_p)Hi.
It's really hard to help you without viewing your code ...
So, personally, I do it this way:
- I use the a4j commandLink or commandButton to call a method called selectBean which simply extracts the getRowData from the DataModel and save it in a field.
- I also add the oncomplete attribute to my commandLink/Button which calls the JS function to show my ModelPanel.
- In my ModalPanel, I'am able to show a message containing infos about the selected bean (thanks to the first step). I also include a confirm commandLink/Button which calls the actual delete method.
Regards. -
2. Re: how to delete selected record using modalPanel?
panky_p Dec 7, 2007 5:29 AM (in response to panky_p)Thanks for reply it seem it will work for me
but how can i getRowData from DataModel?
I am not able to do that!!!
also my problem is how can I send data to modalPanel for edit if Edit button will be clicked??
Thanks for reply
Panky -
3. Re: how to delete selected record using modalPanel?
panky_p Dec 7, 2007 5:47 AM (in response to panky_p)Hi djo
Thanks alot I got it working !!
I was struggling with it from last two days
hanks for help!!!
Panky -
4. Re: how to delete selected record using modalPanel?
panky_p Dec 7, 2007 7:31 AM (in response to panky_p)Hi djo,
it is working on a4j:commandButton but not working on commandLink.
Gives script error object require!!
why is it so?
Thanks
Panky -
5. Re: how to delete selected record using modalPanel?
djo.mos Dec 7, 2007 9:07 AM (in response to panky_p)Well, I'm not sure to understand the error you get, but in my case, this method works perfectly with the commandLink (a4j). May you show your JSF code please ? and the complete error message/stack trace ?
thx -
6. Re: how to delete selected record using modalPanel?
panky_p Dec 7, 2007 10:30 AM (in response to panky_p)Hi,
there is no stack trace error it is something like script error<f:subview> <h:dataTable value="#{myList}" var="newList"> <h:column> <f:facet name="header">Car Name</f:facet> #{newList.myCar} </h:column> <h:column> <f:facet name="header">Type</f:facet> <a4j:commandLink action="#{carBean.editCar()}" value="Edit"/> <a4j:commandLink value="Delete" action="#{carBean.indexCar()}" oncomplete="javascript:Richfaces.showModalPanel('deleteCar',{width:500, top:300})"/> </h:column> </h:dataTable> </f:subview>
and modalPanel is<rich:modalPanel id="deleteCar" minHeight="200" minWidth="200" height="200" width="350" zindex="2000"> <f:facet name="header"> <h:outputText value="Delete Car" /> </f:facet> <f:facet name="controls"><h:graphicImage value="close" style="cursor:pointer" onclick="Richfaces.hideModalPanel('deleteCar')" /> </f:facet> <h:form id="deleteCarForm"> <div> <table> <tr> <td align="center" ><h:outputLabel value="Delete This Car?"/> </td> </tr> <tr> <td style="height:50px" colspan="2" align="center"> <h:commandButton type="button" value=" Yes " action="#{carBean.deleteCar()}" /> <h:commandButton type="button" value=" No " action="javascript:Richfaces.hideModalPanel('deleteCar')" /> </td> </tr> </table> </div> </h:form> </rich:modalPanel>
-
7. Re: how to delete selected record using modalPanel?
djo.mos Dec 8, 2007 3:01 AM (in response to panky_p)Still, without a description of what error are you getting, I can't see how we're supposed to find out what's wrong.
Your code seems fine to me.
Maybe you should upgrade to the latest version of RichFaces ? the 3.1.2 SP 1 ?
Tip: If you are testing in Firefox, you may find out what's wrong by Opening the Errors Console (Tools > Error Console). -
8. Re: how to delete selected record using modalPanel?
panky_p Dec 10, 2007 1:32 AM (in response to panky_p)Hi djo,
I am gettingError: uncaught exception: [Exception... "Object cannot be created in this context" code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location: "http://localhost:8080/test/car/carmain.seam?conversationId=5 Line: 17"] Error: this._form has no properties Source File: http://localhost:8080/test/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript Line: 74
on error console.There is no stack trace it shows alert messageRun time error has occurred Error:Object required
I am not getting why?
Thanks -
9. Re: how to delete selected record using modalPanel?
panky_p Dec 10, 2007 7:01 AM (in response to panky_p)Hi,
I solved it by adding<h:form><h:form> <f:subview> <h:dataTable value="#{myList}" var="newList"> <h:column> <f:facet name="header">Car Name</f:facet> #{newList.myCar} </h:column> <h:column> <f:facet name="header">Type</f:facet> <a4j:commandLink action="#{carBean.editCar()}" value="Edit"/> <a4j:commandLink value="Delete" action="#{carBean.indexCar(ind)}" oncomplete="javascript:Richfaces.showModalPanel('deleteCar',{width:500, top:300})"/> </h:column> </h:dataTable> </f:subview> </h:form>
but now index is not working properly when delete it first time delete first element, then if again click delete it deletes properly selected one.
In my bean class carBean.java to extract row data I am usingpublic String indexCar (Integer ind) { if(carList.size() != 0) { carList.get(index); } return result; }
Why is it so?
I am trying to find it out.
Thanks