Posts

how to access the DOM gwt smartclient

To access the DOM of your page you can call  Document.get() , which has a convenience method for finding an element by it's id  Document.get().getElementById("test"); Of course, you should keep a reference to this element so as not to have to search through the DOM everytime you want to access it, because this is brutal. private Element testDiv = Document.get().getElementById("test"); ... testDiv.setInnerHTML("Some html"); ... testDiv.setInnerHTML("Some other html"); But once you have a reference to this element, calling setInnerHTML is the most efficient way to do what you want. I'm not sure why you think this is brutal. This is probably even more efficient than when you call a method on a widget to change it's content, like  setText(" ...")  on a  TextBox  for example, because these methods usually check the value passed as parameter for security. Security could also be a concern for you, depending on what the

gwt function formatString

How to use formatString function if(record==null || value == null){ if(record!=null && record.isGroupSummary!=null && record.isGroupSummary){ return null; }else{ return "NA"; } }

How to Detect if is Group Summary on record summaryFunction

Hi guys, very ease on summaryFunction just add  record.isGroupSummary or record.isGridSummary case 'clicks': $columnas_raw->title = 'Clicks'; $columnas_raw->type = 'float'; $js = " return  isc.Format.toUSString(value)"; $columnas_raw->formatCellValue =   $js ; //$columnas_raw->recordSummaryFunction = "multiplier"; //$columnas_raw->summaryFunction = "sum"; $columnas_raw->showGridSummary = true; $columnas_raw->showGroupSummary = true; $js = " return  '<div style=\"text-align: left;\">Total<br> <div  style=\"font-weight: normal;\">all -- 32 Product(s)</div> Client/Network<br><div  style=\"font-weight: normal;\">-- unallocated data</div></div>' "; $columnas_raw->summaryFunction = $js ; if (record.isGroupSummary || record.isG

addDataChangedHandler addDataArrivedHandler

        this.grid = listGrid;         this.ds      = (PagerDataSource) listGrid.getDataSource();                 ResultSet dataProperties = new ResultSet();          dataProperties.addDataChangedHandler(new DataChangedHandler() {                    @Override             public void onDataChanged(DataChangedEvent event) {                 System.out.println(" onDataChanged" );                                 RecordList data = grid.getDataAsRecordList();                             if (data != null && data instanceof ResultSet && ((ResultSet)data).lengthIsKnown() && data.getLength() > 0) {                      totalsLabel.setContents(  new Integer(ds.getTotalRows()).toString()   + " Records");                     System.out.println(" Total paginas  :" + new Integer(ds.getTotalPages()).toString() );                     System.out.println(" numero de  pagina :"+ new Integer(ds.getCurrentPage()).toString() );                

response.getData - READ DATA FROM RESPONDE

Record[] records = response.getData(); if(records != null && records.length > 0) { // I have verified that by this point in the code records.length is 1 if(records[0].getAttribute("key") != null) { if(records[0].getAttribute("value") != null) { SC.say(records[0].getAttribute("key") + " is " + records[0].getAttribute("value"); } else { SC.say("value was null"); } } else { SC.say("Invalid response. Did not contain key"); } } else { SC.say("records was null or empty"); }

Create Custom Dialog box smargwt

Create Custom Dialog box 1. replace the dialog class with window class, as the dialog class has no really advantage (as far as I have experienced) 2. use the addMember methode instead the addChild, with this one all layout methods are effectiv. Code: // first final Window purchaseDlg = new Window(); // second, with the vpanel and LayoutSpacer removed (I don't think, you need them any longer) HLayout hpanel = new HLayout(); hpanel.setLayout(Alignment.CENTER); hpanel.addMember(button); purchaseDlg.addItem(hpanel);