Announcement

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

    Disable or hide checkbox in listgrid which has selectionAppearance : checkbox

    I have a listgrid which has selectionAppearance:true. I want to disbale or hide checkbox based some other column value.

    Please let me know if someone has tried it successfully.

    #2
    I am using 7.0 version of Smartclient. I read somewhere that the checkbox created is a autochild of listgrid. Trying to find how to get access to it so that it can be disabled/hidden.
    Last edited by sankg2001; 3 Apr 2011, 04:26.

    Comment


      #3
      Have you tried overriding the showIf property of a listgridfield?

      Comment


        #4
        Yes I tried canEdit, canEditCell, showif etc etc. but didn't work. I am currently using ListGridRecord.enabled = false to disbale selectyion of a particular record. But this is not a good solution as selection of the record should be allowed. Only checkbox should be disabled.

        Comment


          #5
          to gain access to the checkbox, you can use editorProperties - for example I just tried editorProperties:{disabled: true}, when in edit mode the checkbox looks disabled..may be a good point to start? Also canEdit on ListGridField renders the checkboxes as read-only
          Last edited by acarur01; 4 Apr 2011, 07:24.

          Comment


            #6
            I tried editirProperties but no luck.

            Comment


              #7
              no luck as in it doesn't show as read-only for you? If so, then there must be something wrong with your code. Mind sharing a snippet?

              Comment


                #8
                This editorProperties:{disabled: true}, is attached to ListGrid, ListGridField or checkBoxField , ListGridRecord.

                As I want to disable the checkbox when data comes from server based on another column's value.

                Please can you send code snippet as I am very new to smartclient.

                Comment


                  #9
                  editorProperties:{disabled: true}, should be attached to which component ListGrid, ListGridField or checkBoxField , ListGridRecord ?????

                  Comment


                    #10
                    listgridfield

                    Comment


                      #11
                      I tried it in following way which is not working.

                      var obj = this.getCheckboxField();
                      obj.setEditorProperties("disabled", true);

                      this is a reference to ListGrid.

                      Comment


                        #12
                        PLease can you tell me how to apply editorProperties on listgridfield checkbox as there is no corresponding field in list grid.

                        Comment


                          #13
                          You need to override the canEditCell method.

                          @Override
                          protected boolean canEditCell( int rowNum, int colNum )
                          {
                          ListGridRecord row = this.getRecord( rowNum );// grab the record

                          if(//whatever you want to check)
                          return false;
                          else
                          return super.canEditCell( rowNum, colNum );

                          Comment

                          Working...
                          X