Announcement

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

    Few ListGrid problems

    Hello,

    I'm using SmartClient 8.3 and having some problems with the ListGrid.

    Here is the code:

    Code:
          isc.ListGrid.create({
            ID:"exampleList",
            width:"700",
            height:"600",
            alternateRecordStyles:true,
            dataSource:"hqlQuery_114",
            autoFetchData:true,
            showFilterEditor:true,
            showRecordComponents:true,
            virtualScrolling:true,
            fixedRowHeights:true,
            showRecordComponentsByCell:true,
            recordComponentHeight:50,
            resultSize:20,
            canEdit:true,
            editEvent:"click",
            canRemoveRecords:true,
            fields:[
              { name:"id"},
              { name:"name" },
              { name:"state" },
              { name:"entityLabel" },
              { name:"type" }
            ],
    
            createRecordComponent:function (record, colNum) {
    
              var fieldName = this.getFieldName(colNum);
    
              if (fieldName == "id") {
    
                if (record.id < 10) {
    
                  var img = isc.ImgButton.create({
                    showDown:false,
                    showRollOver:false,
                    layoutAlign:"center",
                    src:"/MSP/resources/images/graphical_indicators/flag_green.gif",
                    prompt:record.id,
                    height:16,
                    width:16,
                    grid:this,
                    click:function () {
                      isc.say("Flag for status : " + record.name);
                    }
                  });
    
                  return img;
    
                }
    
              }
              else if (fieldName == "state") {
    
              }
    
              return null;
            },
    
            getCellCSSText:function (record, rowNum, colNum) {
    
              if (this.getFieldName(colNum) == "name") {
    
                if (record.name.indexOf("REQUIREMENT_") == 0) {
    
                  return "background-color: gray;"
    
                }
                else if (record.name.indexOf("RELEASE_") == 0) {
    
                  return "background-color: blue;"
    
                }
    
              }
    
            }
    
          })
    Code:
        /**
         * @param dsRequest
         * @param httpServletRequest
         * @return
         * @throws Exception
         */
        public DSResponse fetch(DSRequest dsRequest, HttpServletRequest httpServletRequest) throws Exception {
    
            DSResponse dsResponse = new DSResponse();
    
            List<? extends PersistenceBaseDTO> data;
    
            IDataAccessService dataAccessService = DaoFactory.getDaoFactory().getDataAccessService();
    
            try {
                dataAccessService.beginSession();
    
                data = (List<? extends PersistenceBaseDTO>) dataAccessService.findAll(Status.class);
    
                int size = data.size();
    
                data = data.subList(new Integer(String.valueOf(dsRequest.getStartRow())), new Integer(String.valueOf(Math.min(dsRequest.getEndRow(), size))));
    
                dsResponse.setData(
                        data
                );
    
                dsResponse.setStartRow(
                        dsRequest.getStartRow()
                );
    
                dsResponse.setEndRow(
                        dsRequest.getEndRow()
                );
    
                dsResponse.setTotalRows(
                        size
                );
    
                dataAccessService.endSession();
    
            }
            catch (Exception ex) {
    
                dataAccessService.rollbackSession();
    
                throw ex;
            }
    
            return dsResponse;
    
        }
    The problems are:

    1. When setting resultSize to 20 I still get 75 in the dsRequest.getEndRow()
    2. Unnecessary space when scrolling all the way down - see image 1
    3. Showing the cell value although using createRecordComponent - See image 2

    Thank you!
    Attached Files
    Last edited by rotemy; 4 Nov 2012, 07:04.

    #2
    Can anyone please take a look at these issues? Thank you.

    Comment


      #3
      Problem 1 solves, please help me with problem 2 and 3.

      Thank you

      Comment

      Working...
      X