Re: FlexTables - store invisible database key in row?
(BTW: is there a better way to convert an int to String than +idx?) Magnus Integer.toString(idx) -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: FlexTables - store invisible database key in row?
You may have a point on table width. Elsewhere I call table.setWidth(100%), but my understanding of the layering is that is bound by higher blocks. However for columns, if the data I'm reading has a width defined for a column, I call columnFormatter.setWidth(col, +width+px). My tables have up to 5 empty columns for various application information. You're technique is a clever solution, and (I think) should work across browsers. Given the vagaries of CSS implementation, over time it might be more reliable than mine. :) On Jul 8, 10:47 pm, Magnus alpineblas...@googlemail.com wrote: Hi Thad, maybe it's because you does not set the width of your table. I do so, and I also set the widths of my columns. However, I found a cool solution that fits perfectly for me and that does not use an extra column for the index at all! I simply store the index as an attribute in the DOM: tbl.getFlexCellFormatter ().getElement (y,0).setAttribute (idx,+idx); // y is the current row, idx is the database index (BTW: is there a better way to convert an int to String than +idx?) Magnus -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: FlexTables - store invisible database key in row?
Hm, this doesn't work for me. All the cells are shifted in their horizontal positions... With your method the table does not behave as if the column width were 0px. I wonder how to deal with this stuff... Magnus On Jul 7, 7:47 pm, Thad thad.humphr...@gmail.com wrote: I do this in a number of places in my application. Use your style sheet: DoubleClickTable rootTable = new DoubleClickTable(); // my class that extends FlexTable HTMLTable.CellFormatter cellFormatter = rootTable.getCellFormatter(); ... rootTable.setText(row, ROWID_COL, record.getAttribute(rowid)); // Set other fields. rootTable.getRowFormatter().setStyleName(row, unselectedRow); // style the row cellFormatter.setStyleName(row, ROWID_COL, hidden-Column); // hide the cell In the CSS, .hidden-Column { display: none; } On Jul 7, 12:54 pm, Magnus alpineblas...@googlemail.com wrote: Hi, I would like to use a FlexTable as a list of users and I need to attach a user id to each row somehow, in order to identify the user when a row is selected. I tried to use a column of width 0px, but this column is visible... How would you do that? Thanks Magnus -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: FlexTables - store invisible database key in row?
Odd. I use this trick in number of different places, and had done so since GWT 1.3 (in fact, I learned the style trick from this list and, in part, from the old Mail sample). It's been tested with Firefox, IE, and Safari. When my cells have been shifted it's because I did not count or order my columns correctly. You might try posting a bit of your code. On Jul 8, 11:38 am, Magnus alpineblas...@googlemail.com wrote: Hm, this doesn't work for me. All the cells are shifted in their horizontal positions... With your method the table does not behave as if the column width were 0px. I wonder how to deal with this stuff... Magnus On Jul 7, 7:47 pm, Thad thad.humphr...@gmail.com wrote: I do this in a number of places in my application. Use your style sheet: DoubleClickTable rootTable = new DoubleClickTable(); // my class that extends FlexTable HTMLTable.CellFormatter cellFormatter = rootTable.getCellFormatter(); ... rootTable.setText(row, ROWID_COL, record.getAttribute(rowid)); // Set other fields. rootTable.getRowFormatter().setStyleName(row, unselectedRow); // style the row cellFormatter.setStyleName(row, ROWID_COL, hidden-Column); // hide the cell In the CSS, .hidden-Column { display: none; } On Jul 7, 12:54 pm, Magnus alpineblas...@googlemail.com wrote: Hi, I would like to use a FlexTable as a list of users and I need to attach a user id to each row somehow, in order to identify the user when a row is selected. I tried to use a column of width 0px, but this column is visible... How would you do that? Thanks Magnus -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: FlexTables - store invisible database key in row?
Look at this simplified example. If you run this, you should see a table with no column or data D. public class HiddenColumnTest implements EntryPoint { public void onModuleLoad() { FlexTable table = new FlexTable(); HTMLTable.CellFormatter cellFormatter = table.getCellFormatter(); String alphas = ABCDEFG; for (int col=0; col alphas.length(); col++) table.setText(0, col, Column +alphas.charAt(col)); table.getRowFormatter().setStyleName(0, columnHeader); cellFormatter.setStyleName(0, 3, hidden-Column); // No D for (int row=1; row = 6; row++) { for (int col=0; col alphas.length(); col++) table.setText(row, col, Data +row+-+alphas.charAt(col)); cellFormatter.setStyleName(row, 3, hidden-Column); // No D } RootPanel.get().add(table); } } In the CSS: .columnHeader { font-weight: bold; } .hidden-Column { display: none; } On Jul 8, 11:38 am, Magnus alpineblas...@googlemail.com wrote: Hm, this doesn't work for me. All the cells are shifted in their horizontal positions... With your method the table does not behave as if the column width were 0px. I wonder how to deal with this stuff... Magnus On Jul 7, 7:47 pm, Thad thad.humphr...@gmail.com wrote: I do this in a number of places in my application. Use your style sheet: DoubleClickTable rootTable = new DoubleClickTable(); // my class that extends FlexTable HTMLTable.CellFormatter cellFormatter = rootTable.getCellFormatter(); ... rootTable.setText(row, ROWID_COL, record.getAttribute(rowid)); // Set other fields. rootTable.getRowFormatter().setStyleName(row, unselectedRow); // style the row cellFormatter.setStyleName(row, ROWID_COL, hidden-Column); // hide the cell In the CSS, .hidden-Column { display: none; } On Jul 7, 12:54 pm, Magnus alpineblas...@googlemail.com wrote: Hi, I would like to use a FlexTable as a list of users and I need to attach a user id to each row somehow, in order to identify the user when a row is selected. I tried to use a column of width 0px, but this column is visible... How would you do that? Thanks Magnus -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: FlexTables - store invisible database key in row?
Hi Thad, maybe it's because you does not set the width of your table. I do so, and I also set the widths of my columns. However, I found a cool solution that fits perfectly for me and that does not use an extra column for the index at all! I simply store the index as an attribute in the DOM: tbl.getFlexCellFormatter ().getElement (y,0).setAttribute (idx,+idx); // y is the current row, idx is the database index (BTW: is there a better way to convert an int to String than +idx?) Magnus -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
FlexTables - store invisible database key in row?
Hi, I would like to use a FlexTable as a list of users and I need to attach a user id to each row somehow, in order to identify the user when a row is selected. I tried to use a column of width 0px, but this column is visible... How would you do that? Thanks Magnus -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: FlexTables - store invisible database key in row?
one way might be to use a ListUser userList private variable in the widget.. the state of the flextable is same as the state of the userList. when a row is selected.. depending on what event selects the row (mouse over, mouseclick..).. update a private User currentUser object. public class MyUserListView extends Composite { private FlexTable userListTable; private ArrayListUser userList=new ArrayListUser(); private User currentSelection; public MyUserListView() { userListTable=new FlexTable(); userListTable.setBorderWidth(1); DOM.setStyleAttribute(userListTable.getElement(), cursor, pointer); initWidget(userListTable); userListTable.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Cell cellClicked= userListTable.getCellForEvent(event); int rowIndex=cellClicked.getRowIndex(); currentSelection=userList.get(rowIndex); Window.alert(U have choosen User: +currentSelection.getFirstname()); } }); } /** * This will mostly be defined in the Presenter view interface. * @param u */ public void addUserToUserTable(User u){ userList.add(u); int row=userListTable.getRowCount(); userListTable.setWidget(row, 0, new HTML(u.getFirstname())); userListTable.setWidget(row, 1, new HTML(u.getLastname())); } public User getCurrentSelection() { return currentSelection; } } in the client class that uses this widget, MyUserListView mul=new MyUserListView(); mul.addUserToUserTable(new User(Firstname1,lastname1)); mul.addUserToUserTable(new User(Firstname2,lastname2)); mul.addUserToUserTable(new User(Firstname3,lastname3)); mul.addUserToUserTable(new User(Firstname4,lastname4)); mul.addUserToUserTable(new User(Firstname5,lastname5)); outerPanel.add(mul); There are a lot of limitations to this as, u can point out. but it sorts the basic issue of maintaining the current state of selected row. there should be better ways to handle this. Experts please comment. Thanks, Subhro. On Wed, Jul 7, 2010 at 10:24 PM, Magnus alpineblas...@googlemail.comwrote: Hi, I would like to use a FlexTable as a list of users and I need to attach a user id to each row somehow, in order to identify the user when a row is selected. I tried to use a column of width 0px, but this column is visible... How would you do that? Thanks Magnus -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.