Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
600
Grid Checkbox Checked Total
posted

Hi,

I have a grid with column that contains a checkbox.  When the grid loads I would like to know how many checkboxes are checked.  I would also like to wire an event to each checkbox that would increment/decrement the total counter when checked/unchecked.  I've attached a sample.  Could you please suggest how I could modify this sample to achieve what I'm looking for?

Thanks,

Rick

igGrid.zip
Parents Reply
  • 17590
    Verified Answer
    Offline posted in reply to Rick Tillotson

    Hello Rick,

    What I can suggest for achieving your requirement is handling the summariesCalculated event. This event is going to be fired when the grid loads initially as well as every time a checkbox value is changed. In this event you could retrieve the count of the checked and unchecked rows and set this as a span`s text. Afterwards, you could just hide the summary rows in order to save your space. For example:

    summariesCalculated: function (evt, ui) {

    var trueValues = ui.owner.summaryCollection().MakeFlag[0].result;

    var falseValues = ui.owner.summaryCollection().MakeFlag[1].result;

    var total = trueValues + falseValues;

    $("#resultSpan").text("There are " + trueValues + " checked rows from " + total);

    $("tr[data-role='summaryrow']").each(function (index) {

    $(this).hide();

    });

    }

    I modified my sample and I am attaching it for your reference.

    I hope this will help you achieve your requirement.

    igGridShowSpanWithCheckedRowsCount.zip
Children