Aug 27, 2013, 11:46 AM
[CLOSED] Removing Checkboxes / Radiobuttons from Frompanel
Hi there,
a Formpanel gets populated dynamically with different Fields. However, when I try to remove all Fields in order to load a new / previous set, the
extnetuser
a Formpanel gets populated dynamically with different Fields. However, when I try to remove all Fields in order to load a new / previous set, the
removeAll()
method fails to remove the Checkboxes properly: the values of all removed checkboxes still get returned by FormPanel.getForm().getValues()
Calling the removeAll() method for the corresponding checkboxgroups does the trick, though. But do I need to do this for every checkboxgroups and radiogroups explicitly or is there a better approach?<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script type="text/javascript"">
function reloadPanel(formPanel) {
// clear the formpanel
formPanel.removeAll(true, true);
//App.Item_456_Group.removeAll(); // <- need to call this?
formPanel.add([
{ id: 'Item_456_Group', xtype: 'checkboxgroup', items: [
{ xtype: 'checkboxfield', name: 'Item_456', boxLabel: 'Input 1', inputValue: '1', uncheckedValue: '-1' },
{ xtype: 'checkboxfield', name: 'Item_456', boxLabel: 'Input 2', inputValue: '2', uncheckedValue: '-2' },
{ xtype: 'checkboxfield', name: 'Item_456', boxLabel: 'Input 3', inputValue: '3', uncheckedValue: '-3' },
{ xtype: 'checkboxfield', name: 'Item_456', boxLabel: 'Input 4', inputValue: '4', uncheckedValue: '-4' }
]},
{ id: 'Item_457', xtype: 'textfield' }
]);
console.log(formPanel.getForm().getValues());
}
</script>
</head>
<body>
@Html.X().ResourceManager()
@(Html.X().FormPanel()
.ID("FormPanel")
.Layout(LayoutType.Anchor)
.Title("FormPanel")
.TrackResetOnLoad(true)
.Buttons(
Html.X().Button().Text("Reload").OnClientClick("reloadPanel(App.FormPanel);")
)
.Items(
Html.X().CheckboxGroup().ID("Item_456_Group").Items(
Html.X().Checkbox().Name("Item_456").BoxLabel("Input 1").InputValue("1").UncheckedValue("-1"),
Html.X().Checkbox().Name("Item_456").BoxLabel("Input 2").InputValue("2").UncheckedValue("-2"),
Html.X().Checkbox().Name("Item_456").BoxLabel("Input 3").InputValue("3").UncheckedValue("-3"),
Html.X().Checkbox().Name("Item_456").BoxLabel("Input 4").InputValue("4").UncheckedValue("-4")
),
Html.X().TextField().ID("Item_457")
)
)
</body>
</html>
Kind regards,extnetuser
Last edited by Daniil; Sep 03, 2013 at 5:01 AM.
Reason: [CLOSED]