Announcement

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

    listgrid.hideFields

    Not sure what I am doing wrong here. I basically want to hide/show columns dynamically by calling hideFields/showFields but once I hide the fields, it's as if they are being removed from the list completely. What am I missing? If I do one by one it works fine (by calling hideField/showField).

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true,
        data: countryData,
        fields:[
            {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png"},
            {name:"countryName", title:"Country"},
            {name:"capital", title:"Capital", showIf:"false"},
            {name:"continent", title:"Continent"}
        ],
        canReorderFields: true
    })
    
    
    isc.IButton.create({
        left:0, top:240,
        title:"Show Capitals",
    click:"var arr = window.Array.create(); arr[0] = countryList.getField('capital');arr[1]=countryList.getField('continent');countryList.showFields(arr);"
    })
    
    isc.IButton.create({
        left:120, top:240,
        title:"Hide Capitals",
        click:"var arr = window.Array.create(); arr[0] = countryList.getField('capital');arr[1]=countryList.getField('continent');countryList.hideFields(arr);"
    })

    #2
    "fields" is indeed just the list of visible fields. What are you trying to do where you think it's important that you get the actual field object? All the APIs allow you to refer to fields by name.

    Comment


      #3
      Yes, I saw this functionality last night, by name is much easier - I am debugging why I cannot get it to work in our environment. I see that if I breakpoint to where I do the hide/show it actually does hide/show the columns I want but as soon as the functions are called, the columns come back regardless of whether I've said to show or hide

      Comment


        #4
        Found the problem - had code that was re-setting the viewState

        Comment

        Working...
        X