Announcement

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

    Showing a checkbox control in a boolean ListGrid field header

    Hello,
    How can I set the field header of a boolean field in a ListGrid to show a checkbox control, similar to the checkbox which appears on the selection column when selectionAppearance="checkbox".

    For example, consider the following sample code (based on showcase https://www.smartclient.com/smartcli...listGridFields):
    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true, 
        canEdit:true,
       selectionAppearance:"checkbox",
        fields:[
            {name:"countryCode", title:"Code"},
            {name:"countryName", title:"Country"},
            {name:"member_g8", title:"G8", type:"boolean"},
            {name:"independence", title:"Nationhood", type:"date", width:100},
            {name:"population", title:"Population", type:"integer"},
            {name:"gdp", title:"GDP", type:"float"}
        ],
        data: countryData
    })
    Assuming I I need the column 'G8' to show a checkbox on its header, just like the selection column header.
    I will also need it to behave the same way - i.e to select\clear all the values in the G8 column and to reflect the current selection (true\false\partial).

    Click image for larger version

Name:	2020-02-09_221637.png
Views:	242
Size:	17.0 KB
ID:	261048

    Could you suggest the recommended way to approach this?

    I am working with Smart Client V12.0p

    Thanks

    #2
    Specify an the checkbox as an icon and add a click handler for the logic. Update the icon via setFieldProperties().

    Comment


      #3
      Oh, actually, I should have mentioned that I'm already using the field icon for something else (there's an indicator on each column header showing whether it's being filtered and allowing access to filtering by that column), so I'm looking for a way which does not involve the field icon.

      Click image for larger version

Name:	2020-02-10_085939.png
Views:	67
Size:	30.0 KB
ID:	261052

      Any suggestions?

      Thanks

      Comment


        #4
        Hi, I'm approaching this by setting the field title to the checkbox image HTML (using Canvas.imgHTML(...)) .
        Is that a correct approach?

        Thanks again.

        Comment


          #5
          Yes, if you are already using the icon for something else, using imgHTML in the title would be an alternate way to show a checkbox icon where the header would normally be.

          Comment

          Working...
          X