问题
I have the same problem, that is mentioned here. The problem got missunderstood and I don't have the privileg to comment so I created this question. He wants to delete a DynamicForm out of an SectionStackSection object. my situation is the following: I added some DynamicForm objects to the SectionStackSection by using the setFields(FormItem... fields) method and I also added a Button to delete this FormItem out of the SectionStackSection. The problem's the same. Also Tried DynamicForm.removeFromParent(), but the parent object is null in DynamicForm.
EDIT: That's how my SectionStack is build:
SectionStack
SectionStackSection
DynamicForm df1 // added via SectionStackSection.addItem(df1)
Button btn1 // added via DynamicForm.addChild(btn1)
ClickHandler ch1
FormItem[] fiList1 // added via DynamicForm.setFields(fiList1)
DynamicForm df2 // added via SectionStackSection.addItem(df2)
Button btn2 // added via DynamicForm.addChild(btn2)
ClickHandler ch2
FormItem[] fiList2 // added via DynamicForm.setFields(fiList2)
// ... some more DynamicForm objects added
DynamicForm dfX
Button btnX
ClickHandler chX
FormItem[] fiListX
SectionStackSection
// ...
// ...
By pressing btn1 for example, df1 should be deleted. The SectionStackSection should be stil shown.
回答1:
Simply call below line
dynamicForm.getElement().removeFromParent();
来源:https://stackoverflow.com/questions/23327241/smartgwt-delete-dynamicform-from-sectionstacksection