Announcement

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

    Group open/close

    Is there any way to dynamically open/close the groupings in a listgrid?

    #2
    There's the "groupStartOpen" property controlling which groups are initially open. There's current no API to open or close specific groups later on.

    Comment


      #3
      On second thought, this is not true - the groupTree is available as grid.groupTree, which means you could call tree.openFolder on it.

      Comment


        #4
        Yup. Ive tried groupStartOpen but cannot change later on. I will try the tree.openFolder

        Comment


          #5
          When changing the data of the listgrid, groupStartOpen property is not retained. Please verify that this is a bug - Click the button to change data of listgrid in the sample

          Code:
          var testData = [
          {pk:0, orderID:8805, itemDescription:"Anti Virus Suite",
              category:"Software", shipDate:new Date(2009,10,20), quantity:2 , unitPrice:50 },
          {pk:1, orderID:4833, itemDescription:"USB Ergonomic Keyboard",
              category:"Hardware", shipDate:new Date(2009,10,13), quantity:1 , unitPrice:99.99 },
          {pk:2, orderID:9551, itemDescription:"Lumbar Support Cushion",
              category:"Hardware", shipDate:new Date(2010,1,2), quantity:1 , unitPrice:75 },
          {pk:3, orderID:954, itemDescription:"USB Keyboard",
              category:"Hardware", shipDate:new Date(2009,10,20), quantity:12 , unitPrice:34.99 },
          {pk:4, orderID:616, itemDescription:"Consulting Services",
              category:"Services", shipDate:new Date(2009,10,10), quantity:40 , unitPrice:100 },
          {pk:5, orderID:8357, itemDescription:"Office Application Suite",
              category:"Software", shipDate:new Date(2010,2,5), quantity:14 , unitPrice:30 },
          {pk:6, orderID:4582, itemDescription:"Anti Virus Suite",
              category:"Software", shipDate:new Date(2010,1,20), quantity:22 , unitPrice:50 },
          {pk:7, orderID:9373, itemDescription:"On-site Training",
              category:"Services", shipDate:new Date(2009,10,20), quantity:20 , unitPrice:100 },
          {pk:8, orderID:9311, itemDescription:"Software Development Kit",
              category:"Software", shipDate:new Date(2009,10,10), quantity:8 , unitPrice:249.99 },
          {pk:9, orderID:7806, itemDescription:"15 inch flat panel monitor",
              category:"Hardware", shipDate:new Date(2009,11,12), quantity:4 , unitPrice:300 }
          ];
          
          var testData2=[
          {pk:0, orderID:8620, itemDescription:"18 inch flat panel monitor",
              category:"Other", shipDate:new Date(2009,11,11), quantity:2 , unitPrice:375 },
          {pk:1, orderID:629, itemDescription:"Office Productivity Suite", 
              category:"Other", shipDate:new Date(2009,12,10), quantity:15 , unitPrice:64.99 },
          {pk:2, orderID:1264, itemDescription:"Office Productivity Suite",
              category:"Other", shipDate:new Date(2009,12,20), quantity:2 , unitPrice:64.99 },
          {pk:3, orderID:7100, itemDescription:"USB Ergonomic Keyboard",
              category:"Other", shipDate:new Date(2009,10,20), quantity:6 , unitPrice:99.99 },
          {pk:4, orderID:9647, itemDescription:"Consulting Services",
              category:"Other", shipDate:new Date(2009,12,21), quantity:10 , unitPrice:100 },
          {pk:5, orderID:8468, itemDescription:"USB Optical Mouse",
              category:"Other", shipDate:new Date(2009,10,10), quantity:5 , unitPrice:29.99 },
          {pk:6, orderID:9496, itemDescription:"Off-site Training",
              category:"None", shipDate:new Date(2010,1,1), quantity:35 , unitPrice:80 },
          {pk:7, orderID:5124, itemDescription:"USB Stereo Headset",
              category:"Other", shipDate:new Date(2009,10,20), quantity:1 , unitPrice:69.99 },
          {pk:8, orderID:1799, itemDescription:"Office Application Suite",
              category:"Other", shipDate:new Date(2009,11,2), quantity:22 , unitPrice:30 },
          {pk:9, orderID:7020, itemDescription:"Consulting Services",
              category:"None", shipDate:new Date(2009,12,20), quantity:100 , unitPrice:80 }];
          
          
          
          isc.ListGrid.create({
              ID: "companyList",
              width:600, height: 300,
              alternateRecordStyles:true,
              autoFetchData:true,
              data: testData,
              groupByField:"category", 
              groupStartOpen:"all",
              canEdit:true, editEvent:"click",
          
              fields:[
                  {name:"orderID"},
                  {name:"itemDescription"},
                  {name:"category"},
                  {name:"shipDate"}, 
                  {name:"quantity"},
                  {name:"unitPrice"}
              ]
          });
          
          isc.Button.create({
          title: "click",
          width: 150,
          left: 700,
          top: 150,
          click: function() {
          companyList.setData(testData2); }
          });

          Comment


            #6
            Yes, this is a bug. Among other workarounds, you could ungroup and re-group:

            Code:
            companyList.ungroup();
            companyList.setData(testData2); 
            companyList.groupBy("category");

            Comment


              #7
              Thanks. I will be upgrading to a later nightly build soon. Please let me know when this is fixed.

              Comment


                #8
                This is now resolved (on the 8.1.x branch)

                Comment


                  #9
                  I am still getting some cases where the groupstart property is not retained. I cannot reproduce as a standalone. We have a sort of "manual" paging implemented. I am not sure what to look at to debug in this case. It usually loses groupstart when I go back to a previous set of data. Do you have any suggestions as to what could be happening? What if I provide all the dsrequest/response up to where the groupstart is lost?

                  Comment


                    #10
                    It's unlikely to be anything related to specific DSRequests/DSResponses unless the responses are actually invalid, it's more likely to do with a weird sequence of calls. From code inspection, no particular scenario suggests itself - every time we re-create the groupTree, the groupStartOpen property is applied, it's unconditional.

                    Sorry, but we're probably not going to be able to provide any more help than that until you get a reproducible case.

                    Comment


                      #11
                      Ok. Is there anything I can check in the listgrid when dataArrived is called? What properties are being set? What should I look for in the listgrid.groupTree?

                      Comment


                        #12
                        The implementation is the same as what we recommended for manual use - once the groupTree is formed we use the groupStartOpen setting to call openFolder() on the appropriate folders.

                        Comment

                        Working...
                        X