Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Canīt get Dinamic Form Fields

    Hi I'm new to SmartGWT, and I am trying to create a dinamic form with a tabset,
    linked to a Datasource, I can see the fields in the Dinamicform but the problem is, that i want to access the fields on the Dinamic form to manipulate them eg. hide(), SetcolSpan(), etc...

    I use this code, as you can see below i have used both getField() and getFields(), but, no luck, getFields() say there is no fields and getField launch an exception because there that field does not exists... I have tried too to assign the datasource directly to the dinamicForm, but had the same result...

    Thanks in advance
    H Romero

    private VLayout generateDesktopForm()
    {
    vm = new ValuesManager();
    vm.setDataSource(fResource.resourceDS);

    VLayout theLayout = new VLayout();

    Element TabsNode = (Element) fElement.getFirstChild();

    NodeList tabs = TabsNode.getElementsByTagName("FORMLABEL");

    if (tabs.getLength() > 1)
    {
    final TabSet topTabSet = new TabSet();
    topTabSet.setTabBarPosition(Side.TOP);
    topTabSet.setWidth("100%");
    topTabSet.setHeight("100%");
    for (int i = 0; i < tabs.getLength(); i++) {

    Element tab = (Element) tabs.item(i);

    Tab tTab1 = new Tab(tab.getAttribute("CAPTION"));

    tTab1.setPane(generateDinamicForm(tab));
    topTabSet.addTab(tTab1);
    }

    theLayout.addMember(topTabSet);

    } else {

    Element tab = (Element) tabs.item(0);
    theLayout.addMember(generateFields(tab));
    }

    return theLayout;
    }


    private DynamicForm generateDinamicForm(Element theTab)
    {

    DynamicForm form0 = new DynamicForm();
    form0.setID("TAB"+theTab.getAttribute("IDTAB"));
    form0.setValuesManager(vm);
    form0.setNumCols(4);
    form0.setUseAllDataSourceFields(true);

    //form0.getField("IDUSER").hide();
    //form0.getField("IDEMPLOYEE").hide();

    for (FormItem formItem : form0.getFields()) {
    if (formItem.getName().equals("IDEMPLOYEE")) {
    formItem.hide();
    }
    }



    form0.draw();

    //form0.getField("IDEMPLOYEE").hide();
    return form0;

    }
Working...
X