2011-11-22 14 views
0

如果使用smartGWT开发通用客户端。 我们设计我们的应用程序为: 在屏幕的左侧,我们有树形导航器, ,在右边我们显示目标树元素的形式(onClick树项目)。 在显示表单时,我们使用的是笔记本,也就是说,无论何时点击一个树状项目,我们都会在笔记本中添加一个标签以显示其相关表单。 因此多个表单可能同时存在于DOM中。如果以不同的形式包含在不同的smartgwt笔记本中具有相同的widget-name-field

My query is: 
what if multiple notebooks (thus different forms) say X and Y have same-field-widget say 'name', 
Will this cause ID conflict problem in operation like `save` or `onchange` or simply is this a good practice in smartGWT? 

Note: we want to generate same ID of the widget each time we generate particular form, for some testing purpose. 
+0

您是否根据自己的要求编写了一些代码?你可以在这里发布吗? – RAS

+0

实际上,目前我们没有将ID分配给自动生成的小部件。但正如我所说的,在进行测试时(使用硒),我认为分配唯一的ID将解决我们硒问题,所以问这个含糊不清。 – Shanta

回答

0

在看看this link 显示有没有冒犯的良好做法,如果你运行简单的下面的测试代码,你可以使用Firebug看到ID,以不同的形式 但无论如何,使用相同的属性名称与SmartGWT的并且名称属性自动生成,并且值增加,因此甚至没有重复值...

public static void testMultiForms() { 
    VLayout theForms = new VLayout(); 
    MyForm f1 = new MyForm(); 
    MyForm f2 = new MyForm(); 
    MyForm f3 = new MyForm(); 
    theForms.addMember(f1); 
    theForms.addMember(f2); 
    theForms.addMember(f3); 
    RootPanel.get("container").add(theForms);  
} 

public MyForm(){ 
    TextItem name = new TextItem(); 
    name.setTitle("Name"); 
    TextItem address = new TextItem(); 
    address.setTitle("Address"); 
    this.setItems(name,address); 
}  
+0

是的,在自动生成的ID中没有可复制的,Butmy的问题是,如果我将重复名称分配给包含在DOM中的不同形式的窗口小部件,该怎么办? – Shanta

+0

你尝试添加setName()吗? –

相关问题