Announcement

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

    #31
    Ok, so I'm trying to get the full path to the image, I have the skin turned on via:
    Code:
    <inherits name="com.smartgwtpower.SmartGwtPower"/>
    And when I execute the following code:
    Code:
    GWT.log("grid.getBooleanTrueImage():" + grid.getBooleanTrueImage(), null);
    GWT.log("grid.getCheckboxFieldTrueImage():" + grid.getCheckboxFieldTrueImage(), null);
    I only get nulls in the Dev Console:
    Code:
    [INFO] grid.getBooleanTrueImage():null
    [INFO] grid.getCheckboxFieldTrueImage():null
    Is this OK?

    Comment


      #32
      Expected (due to the dynamic defaulting discussed in the docs), but why use this method? The default value is documented and Firebug will also show you the requested path if you load the original skin.

      Comment


        #33
        Your posting #25 on this thread said to see ListGrid.booleanTrueImage and booleanFalseImage for the full path.

        I'll check the Javadoc to CheckboxItem to get more details thanks.

        Comment


          #34
          I understand there is no support with skinning issues, however, perhaps you could shed some light on what I have discovered so far. The ListGridField of type Boolean seems to be stuck on rendering the image:

          Code:
          <img width="15" height="15" align="absMiddle" style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://localhost:8084/tzw/com.tz.Main/sc/skins/an/images/DynamicForm/checked_Disabled.png",sizingMethod="scale"); MARGIN-LEFT: 2px; VERTICAL-ALIGN: middle; MARGIN-RIGHT: 2px;" src="http://localhost:8084/tzw/com.tz.Main/sc/skins/an/images/blank.gif" border="0" complete="complete" suppress="TRUE" eventpart="valueicon"/>
          Please note that the actual image that is being used is the checked_Disabled.png image. Any idea as to why the 'disabled' image is being chosen? Is there a ListGridField state I need to change in the code to 'enable' this widget?
          Last edited by jasmith; 12 Jan 2011, 10:51.

          Comment


            #35
            There's support for skinning issues.

            The only scenario we know of that would cause this is a field that's marked canToggle:true but is not editable.

            Comment


              #36
              Bingo, that was it, the check box is now rendering a check when true. Thank you.

              Comment


                #37
                Is there any way to prevent a DataSource 'update' call being sent to the server for a ListGridField of type Boolean?

                To get the checkbox rendering properly I have to:
                Code:
                ListGridField selectBox = new ListGridField("Select");
                selectBox.setType(ListGridFieldType.BOOLEAN);
                selectBox.setCanEdit(Boolean.TRUE);
                selectBox.setCanToggle(Boolean.TRUE);
                The issue here is we are using this ListGridField check box to represent state in a Flash object contained in the Window that the ListGrid is a part of. There is no underlying data in the database in which the ListGridField check box needs to 'update' when the state changed from true to false (or vice versa). So there is no need to make a DataSource 'update' call, but the CanEdit property to the ListGridField assumes there will be an 'update' call made.

                Currently if I set only CanToggle, the check box is still selecting the 'check_Disabled.png' image.

                Can we get this resolved? Or is there another way to suppress the DataSource 'update' call if CanEdit is set to TRUE?

                Comment


                  #38
                  Code:
                  grid.setAutoSaveEdits(Boolean.FALSE);
                  This will suppress the auto 'update' DataSource call.

                  Comment


                    #39
                    Upon further testing, I have a question regarding the actual value of the ListGridField, now the check box is rendering the check but the underlying value is false even though the box is showing a check?

                    Code:
                    private ListGrid grid;
                    
                        public void onModuleLoad() {
                            HLayout layout = new HLayout();  
                            layout.setWidth(300);
                            layout.setHeight(200);
                            layout.setMembersMargin(20);
                    
                    
                    
                            grid = new ListGrid();
                            grid.addRecordClickHandler(new RecordClickHandler() {
                                public void onRecordClick(RecordClickEvent event) {
                                    GWT.log("onRecordClick feildName:" + grid.getFieldName(event.getFieldNum()), null);
                                    if("Select".compareTo(grid.getFieldName(event.getFieldNum())) == 0) {
                                        
                                        ListGridRecord listGridRecord = grid.getSelectedRecord();
                                        GWT.log("value:" + listGridRecord.getAttributeAsBoolean("Select"), null);
                    
                                    }
                    
                    
                                }
                            });
                            
                            ListGridRecord record1 = new ListGridRecord();
                            record1.setAttribute("one", "1");
                            record1.setAttribute("two", "1");
                            record1.setAttribute("three", "1");
                    
                            ListGridRecord record2 = new ListGridRecord();
                            record2.setAttribute("one", "2");
                            record2.setAttribute("two", "2");
                            record2.setAttribute("three", "2");
                    
                            ListGridRecord record3 = new ListGridRecord();
                            record3.setAttribute("one", "3");
                            record3.setAttribute("two", "3");
                            record3.setAttribute("three", "3");
                    
                            ListGridRecord[] records = new ListGridRecord[3];
                            records[0] = record1;
                            records[1] = record2;
                            records[2] = record3;
                    
                            ListGridField field0 = new ListGridField("Select");
                            field0.setType(ListGridFieldType.BOOLEAN);
                            field0.setCanEdit(Boolean.TRUE);
                            field0.setCanToggle(Boolean.TRUE);
                    
                    
                            ListGridField field1 = new ListGridField("one", "one");
                            ListGridField field2 = new ListGridField("two", "two");
                            ListGridField field3 = new ListGridField("three", "three");
                            ListGridField[] fields = new ListGridField[4];
                            fields[0] = field0;
                            fields[1] = field1;
                            fields[2] = field2;
                            fields[3] = field3;
                    
                    
                            grid.setAutoFetchData(Boolean.FALSE);
                            grid.setEditEvent(ListGridEditEvent.NONE);
                            grid.setAutoSaveEdits(Boolean.FALSE);
                            grid.setFields(fields);
                            grid.setData(records);
                    
                    
                            layout.addMember(grid);
                    
                            DynamicForm df = new DynamicForm();
                            CheckboxItem check = new CheckboxItem("checkbox1", "Check");
                            df.setItems(check);
                            layout.addMember(df);
                    
                    
                            layout.draw();
                        }
                    No matter now many times I click on the check box, and weather the check is rendered or not, the value is always false?
                    Is this the expected behavior?

                    Comment


                      #40
                      With autoSaveEdits turned off, the edits are held. You can retrieve these with grid.getEditedRecord() or submit them with saveAllEdits(). See the grid editing overview in the docs.

                      Comment


                        #41
                        Ok, I've revised the test case and I'm still getting unexpected behavior:
                        Code:
                        private ListGrid grid;
                        
                            public void onModuleLoad() {
                                HLayout layout = new HLayout();  
                                layout.setWidth(300);
                                layout.setHeight(200);
                                layout.setMembersMargin(20);
                        
                        
                        
                                grid = new ListGrid();
                                grid.addRecordClickHandler(new RecordClickHandler() {
                                    public void onRecordClick(RecordClickEvent event) {
                                        GWT.log("onRecordClick feildName:" + grid.getFieldName(event.getFieldNum()), null);
                                        if("Select".compareTo(grid.getFieldName(event.getFieldNum())) == 0) {
                                            
                                            ListGridRecord listGridRecord = grid.getRecord(event.getRecordNum());
                                            GWT.log("ListGridRecord value:" + listGridRecord.getAttributeAsBoolean("Select"), null);
                        
                                            Record record = grid.getEditedRecord(event.getRecordNum());
                                            GWT.log("Record value:" + record.getAttributeAsBoolean("Select"), null);
                        
                                        }
                        
                        
                                    }
                                });
                                
                                ListGridRecord record1 = new ListGridRecord();
                                record1.setAttribute("one", "1");
                                record1.setAttribute("two", "1");
                                record1.setAttribute("three", "1");
                        
                                ListGridRecord record2 = new ListGridRecord();
                                record2.setAttribute("one", "2");
                                record2.setAttribute("two", "2");
                                record2.setAttribute("three", "2");
                        
                                ListGridRecord record3 = new ListGridRecord();
                                record3.setAttribute("one", "3");
                                record3.setAttribute("two", "3");
                                record3.setAttribute("three", "3");
                        
                                ListGridRecord[] records = new ListGridRecord[3];
                                records[0] = record1;
                                records[1] = record2;
                                records[2] = record3;
                        
                                ListGridField field0 = new ListGridField("Select");
                                field0.setType(ListGridFieldType.BOOLEAN);
                                field0.setCanEdit(Boolean.TRUE);
                                field0.setCanToggle(Boolean.TRUE);
                        
                        
                                ListGridField field1 = new ListGridField("one", "one");
                                ListGridField field2 = new ListGridField("two", "two");
                                ListGridField field3 = new ListGridField("three", "three");
                                ListGridField[] fields = new ListGridField[4];
                                fields[0] = field0;
                                fields[1] = field1;
                                fields[2] = field2;
                                fields[3] = field3;
                        
                        
                                grid.setAutoFetchData(Boolean.FALSE);
                                grid.setEditEvent(ListGridEditEvent.NONE);
                                grid.setAutoSaveEdits(Boolean.FALSE);
                                grid.setFields(fields);
                                grid.setData(records);
                        
                        
                                layout.addMember(grid);
                        
                                DynamicForm df = new DynamicForm();
                                CheckboxItem check = new CheckboxItem("checkbox1", "Check");
                                df.setItems(check);
                                layout.addMember(df);
                        
                        
                                layout.draw();
                            }
                        The Grid comes up and all 3 check boxes are empty, so I click the first box and the check appears in the check box and the output is:
                        Code:
                        [INFO] onRecordClick feildName:Select
                        [INFO] ListGridRecord value:false
                        [INFO] Record value:false
                        I click on the first check box again, the check disappears in the check box and the output is:
                        Code:
                        [INFO] onRecordClick feildName:Select
                        [INFO] ListGridRecord value:false
                        [INFO] Record value:true
                        Is this expected?

                        Comment


                          #42
                          Is there any status?

                          Comment


                            #43
                            Yes, that's expected. With autoSaveEdits:false, changes are kept as editValues (what getEditorRecord() returns) until you manually save (saveAllEdits()).

                            Comment


                              #44
                              Sorry, the example wasn't clear. I understand the concept of autoSaveEdits:false.

                              Code:
                              private ListGrid grid;
                              
                                  public void onModuleLoad() {
                                      HLayout layout = new HLayout();  
                                      layout.setWidth(300);
                                      layout.setHeight(200);
                                      layout.setMembersMargin(20);
                              
                              
                              
                                      grid = new ListGrid();
                                      grid.addRecordClickHandler(new RecordClickHandler() {
                                          public void onRecordClick(RecordClickEvent event) {
                                              GWT.log("onRecordClick feildName:" + grid.getFieldName(event.getFieldNum()), null);
                                              if("Select".compareTo(grid.getFieldName(event.getFieldNum())) == 0) {
                              
                                                  Record record = grid.getEditedRecord(event.getRecordNum());
                                                  GWT.log("Record value:" + record.getAttributeAsBoolean("Select"), null);
                              
                                              }
                              
                              
                                          }
                                      });
                                      
                                      ListGridRecord record1 = new ListGridRecord();
                                      record1.setAttribute("one", "1");
                                      record1.setAttribute("two", "1");
                                      record1.setAttribute("three", "1");
                              
                                      ListGridRecord record2 = new ListGridRecord();
                                      record2.setAttribute("one", "2");
                                      record2.setAttribute("two", "2");
                                      record2.setAttribute("three", "2");
                              
                                      ListGridRecord record3 = new ListGridRecord();
                                      record3.setAttribute("one", "3");
                                      record3.setAttribute("two", "3");
                                      record3.setAttribute("three", "3");
                              
                                      ListGridRecord[] records = new ListGridRecord[3];
                                      records[0] = record1;
                                      records[1] = record2;
                                      records[2] = record3;
                              
                                      ListGridField field0 = new ListGridField("Select");
                                      field0.setType(ListGridFieldType.BOOLEAN);
                                      field0.setCanEdit(Boolean.TRUE);
                                      field0.setCanToggle(Boolean.TRUE);
                              
                              
                                      ListGridField field1 = new ListGridField("one", "one");
                                      ListGridField field2 = new ListGridField("two", "two");
                                      ListGridField field3 = new ListGridField("three", "three");
                                      ListGridField[] fields = new ListGridField[4];
                                      fields[0] = field0;
                                      fields[1] = field1;
                                      fields[2] = field2;
                                      fields[3] = field3;
                              
                              
                                      grid.setAutoFetchData(Boolean.FALSE);
                                      grid.setEditEvent(ListGridEditEvent.NONE);
                                      grid.setAutoSaveEdits(Boolean.FALSE);
                                      grid.setFields(fields);
                                      grid.setData(records);
                              
                              
                                      layout.addMember(grid);
                              
                                      DynamicForm df = new DynamicForm();
                                      CheckboxItem check = new CheckboxItem("checkbox1", "Check");
                                      df.setItems(check);
                                      layout.addMember(df);
                              
                              
                                      layout.draw();
                                  }
                              If you run the code above, you will see the GWT.log() call during the onRecordClicked event prints the value of the grid.getEditedRecord(event.getRecordNum()) call. What I wanted to ask was the expected value of the record.getAttributeAsBoolean("Select") call.

                              When the check box has a check in the box, the value is false, when the check box does not have a check, the value is true.

                              Is this expected behavior? I would think its the other way around?

                              Comment


                                #45
                                Are you trying to see the value before or after the canToggle behavior has switched it? Because some events fire before (Change), some after (Changed).

                                Comment

                                Working...
                                X