Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SelectItem getData().getLength() is not a function?!!

    Hi there,

    I use the lastest smartGWT version and Safari MacOS.
    Iīm having the following problem:

    I get the error message 'is not a function' when trying to call the method getLength() in the object SelectItem!

    Code:
    SelectItem mandantSel = new SelectItem("MandantSelection");
    mandantSel.addDataArrivedHandler(new DataArrivedHandler() {
    				
    	@Override
    	public void onDataArrived(DataArrivedEvent aEvent) {	
    		ResultSet resultSet = aEvent.getData();
    		int profilesCount = resultSet.getLength(); // ERROR!
    	}
    Attached Files
    Last edited by GWTDummies; 4 Jun 2010, 16:57.

    #2
    Hi there,

    this element delivers a reference to the PickListīs data!
    That is why this method is not available.

    But does anyone know, how can I retrieve the count of rows
    in a SelectItem (in DataArrivedHandler)?

    Thanks in advance ;-)

    Comment


      #3
      DataArrivedEvent.getStartRow() and DataArrivedEvent.getEndRow() ?

      Comment


        #4
        WOW, Iīm really a dummy. It worked!
        Thank you very much svjard!

        Comment


          #5
          Hi svjard, or anyone ;-)

          I have another question now.

          Explanation: The idea is a loginn window with a combobox.
          After a sucessfull login, if the user has more than one profile,
          these should be displayed for selection, if the user only has
          one profile, then this will be (automatically) taken to do the login.

          Using a DataArrived handler, I tried to get the only row in the selectItem (logged user has only one profile) .
          Inside this DA. handler (calling event.getEndRow()) I can get the index of rows that have been just loaded,
          but when I call selectItem.filterClientPickListData() or getClientPickListData() I get no data.
          Why?
          How can I get the first record (not selected) in the SelectItem?
          Last edited by GWTDummies; 8 Jun 2010, 07:15.

          Comment


            #6
            Interesing use case, so since your databound, getClientPickListData() is for non-databound items, see the javadocs for more explanation on that. And filterClientPickListData() acts off of the returned list of getClientPickListData(), so that is how those two functions interact.

            To get the first non-selected record, add setClientOnly(true); to your datasource, shouldn't be an issue for a picklist, then at whatever point you do your logic use sItem.getOptionDataSource().getCacheData(), and you can use sItem.getSelectRecord() or even sItem.getValue() to compare against the id field in the records to find matches / non-matches, The getCacheData() is in order as it appears in your picklist as well, so it will give you the first non-selected record.

            Comment


              #7
              Solved, thanks!

              Comment

              Working...
              X