2012-02-24 40 views
1

我正在顯示CellTable像顯示如下─enter image description here如何通過單擊CellTable中的單元格來打開彈出式面板?

刪除按鈕我想其中應該包含的流面板,並在其中一個按鈕在屏幕的中央打開一個彈出面板中點擊。
眼下的刪除按鈕,我有以下功能 -

deleteColumn.setFieldUpdater(new FieldUpdater<Contact, String>() { 
     public void update(int index, Contact object, String value) {   
      try { 
       int removeIndex = CONTACTS.indexOf(object); 
       CONTACTS.remove(removeIndex); 

       table.setRowCount(CONTACTS.size(), true); 
       table.setRowData(CONTACTS); 

       table.redraw(); 

      } catch(Exception e) { 
       e.printStackTrace(); 
      }}); 

我不明白如何更新我的相同的功能。示例代碼肯定會有所幫助。

回答

2

剛剛顯示​​怎麼樣?

事情是這樣的:

PopupPanel popup = new PopupPanel(true); 
FlowPanel panel = new FlowPanel(); 
//add Button etc 
popup.setSize("1100px","500px"); 
popup.clear(); 
popup.add(panel); 
popup.show(); 
popup.center(); 

如果要顯示比這個代碼確認對話框很容易:

if (Window.confirm("Do you really want to delete the dataset?")) 
{ 
    //delete code 
} 
+0

謝謝!工作得很好! – Prince 2012-02-25 01:55:31

0

像這樣的事情?

ButtonCell buttonCell = new ButtonCell(){ 
     @Override 
     public Set<String> getConsumedEvents() { 
      // TODO Auto-generated method stub 
      //return super.getConsumedEvents(); 
      Set<String> events = new HashSet<String>(); 
      events.add("click"); 

      return events; 
     } 
    }; 
    productTable.addColumn(new Column<ProductDetails, String>(buttonCell) { 
     @Override 
     public String getValue(ProductDetails object) { 
      // TODO Auto-generated method stub 
      return "Edit"; 
     } 
     @Override 
     public void onBrowserEvent(Context context, Element elem, 
       ProductDetails object, NativeEvent event) { 
      // TODO Auto-generated method stub 
      super.onBrowserEvent(context, elem, object, event); 
      if("click".equals(event.getType())){ 
       presenter.onEditButtonClicked(object); 
      } 
     } 
    }, "Commands"); 

請試試看,並讓我知道結果。我只是寫了,並沒有測試它:|

相關問題