Announcement

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

    ListGrid "selectAllRecords"

    I have a listgrid initially set to paged. Our clients want to be able to select all records and perform certain actions such as delete on them. I dynamically set showAllRecords and dataFetchMode and invalidateCache then in dataArrived I attempt to selectAllRecords but I still get the popup saying I should work with smaller batches which I thought would go away once I have all the data in the fetched - am I doing something wrong? Is there another approach I should be taking?

    Code:
    
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true,
        dataSource: worldDS,autoFetchData:true,
        // display a subset of fields from the datasource
        fields:[
            {name:"countryCode"},
            {name:"countryName"},
            {name:"capital"},
            {name:"continent"}
        ],
        sortFieldNum: 1, // sort by countryName
    dataArrived: function(startRow,endRow){
       if(countryList.$cwSelectAll){
           countryList.selectAllRecords();
       }
    
    countryList.$cwSelectAll = null;
    }
    
    })
    
    
    isc.Button.create({
    top:300,
    title: "Select All",
    click: function(){
    countryList.setProperties("dataFetchMode", "basic");
    countryList.setProperties("showAllRecords", true);
    countryList.invalidateCache();
    countryList.$cwSelectAll = true;
    }
    })
    DS

    Code:
    <DataSource
        ID="worldDS"
        serverType="sql"
        recordName="country"
        testFileName="/examples/shared/ds/test_data/world.data.xml"
    >
        <fields>
            <field name="pk"            type="integer"    hidden="true"            primaryKey="true" />
            <field name="countryCode"   type="text"       title="Code"             required="true"   />
            <field name="countryName"   type="text"       title="Country"          required="true"   />
            <field name="capital"       type="text"       title="Capital"          />
            <field name="government"    type="text"       title="Government"       length="500"      />
            <field name="continent"     type="text"       title="Continent"        >
                <valueMap>
                    <value>Europe</value>
                    <value>Asia</value>
                    <value>North America</value>
                    <value>Australia/Oceania</value>
                    <value>South America</value>
                    <value>Africa</value>
                </valueMap>
            </field>
            <field name="independence"  type="date"       title="Nationhood"          />
            <field name="area"          type="float"      title="Area (km&amp;sup2;)" />
            <field name="population"    type="integer"    title="Population"          />
            <field name="gdp"           type="float"      title="GDP ($M)"            />
            <field name="member_g8"     type="boolean"    title="G8"                  />
        </fields>
    </DataSource>
    Last edited by acarur01; 19 Jan 2012, 14:32.

    #2
    You do not want to set showAllRecords:true in this case, that causes all records to be rendered, which will be much slower. There also no reason to try to switch dataFetchMode since you're just trying to do this once, for the current recordset. Instead, just do this:

    Code:
    grid.data.getRange(0, grid.data.getLength());
    .. then wait for DataArrived as you currently are. If there seems to be a problem where this is still not filling the dataset, look closely at the RPC tab to see if you are actually delivering all the data back to the client, or if the dataset still ends up incomplete.

    Comment


      #3
      Thanks this works - problem now is dealing with IE's script running too long message when I selectAllRecords which has over 1000 rows. Any suggestions on this?

      Comment


        #4
        Its slightly surprising that you'd be seeing a script running slowly block from selecting 1000 rows in IE8 (though that browser does show this message quite aggressively).

        We'd recommend first checking to make sure this isn't caused by some processing you're doing in your app - for example if you're firing a callback in response to every 'selection changed' event on the grid.
        You can test this by creating a simple grid in your application bound to the data source, populating with the same full set of rows and calling 'selectAllRecords()' on it. If this doesn't trip the warning, take a look at your app and see if you can simplify it to avoid intensive processing on selection in the "real" grid.

        If you still see the warning for your simple grid, or are unable to simplify your application code to drop it, another option would be to set up a custom fetch operation which marks the returned records as selected before handing them to the client (by setting the value of the ListGrid selection property to true - that's isSelected by default). You'd then use this fetch to populate the grid with already selected rows.

        Comment


          #5
          Hmm this is a valid point - selectionChanged callback is quite likely.

          Comment


            #6
            Removed our selectionChanged callback and I still get the message - matter of fact, I can reproduce as a standalone! :)


            I will send the test file in an email

            Comment


              #7
              Looks like the limit for this grid is 422 records?

              Also, I tried your suggestion with already fetching with isSelected set to true and it does make the message go away..until I click on a single record and the listgrid deselects everything else - then I get the message again.
              Last edited by acarur01; 20 Jan 2012, 12:08.

              Comment


                #8
                It looks like you may have sent the wrong test-file to support? It appears not to relate to this thread.

                Anyway, we've made significant optimizations in this area today and these should address your slow-script warnings. Please retry with a nightly build after today (24th or later, 8.2p and 8.3d have been fixed) and let us know if your issues remain.

                Comment


                  #9
                  Oops. You're right sent the wrong file - I will test again with the 01-23-2012 build

                  Comment


                    #10
                    My issue is still reproduceable - I've sent the proper file to support

                    Comment


                      #11
                      As was mentioned above "Please retry with a nightly build after today (24th or later, 8.2p and 8.3d have been fixed) and let us know if your issues remain." - the 23 build will not include the fixes

                      Comment


                        #12
                        Oh - sorry misread! Will update tomorrow

                        Comment


                          #13
                          This works with the 2012-01-24 build. Thanks.

                          Comment


                            #14
                            Since upgrading to this build, our treegrid selection has broken. selectionChanged() no longer gets called - I see that cellClick is called but that's about it. What has changed between 23rd build and the 24th build?

                            Comment


                              #15
                              The optimization change to improve the 'selectAllRecords' performance introduced a different selection bug which made it into the Jan 24th build.
                              The bug has been caught and fixed already. Please try with the January 26th build and let us know if you still have problems (either with the script running slowly message or with this new problem)

                              Thanks
                              Isomorphic Software

                              Comment

                              Working...
                              X