2011-11-22 65 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()嗎? –

相關問題