Skip to Content
-3
Jun 24, 2018 at 11:15 AM

how count the number of check boxes checked in table when clicking the submit button?

738 Views Last edit Aug 01, 2018 at 06:05 AM 5 rev

can anyone tell me how to count the checked check boxes when clicking the submit button.

controller.js

//Length ---->press event
Length: function(oEvent)
  { var i = 0, count = 0; var flag = false;
  $.each(this.getView().byId("Ranjith"),

function(index, row) {
  if (row.getChecked() == true)
    { flag = true; count += 1; } });
  alert("count = " + count); }

view.xml:

<Table id="Ranjith" inset="true">
  <columns>
    <Column width="3em"> </Column>
    <Column minScreenWidth="Medium" demandPopin="true" hAlign="Left">
      <Text text="Date"/>
    </Column>
    <Column minScreenWidth="Medium" demandPopin="true" hAlign="Left">
      <Text text="Document Type"/>
    </Column>
    <Column width="10em"> 
      <Text text="Document Discription"/> 
    </Column>
    <Column minScreenWidth="Medium" demandPopin="true" hAlign="Right"> 
       <Text text="Document No."/>
    </Column>
    <Column minScreenWidth="Medium" demandPopin="true" hAlign="Right">
       <Text text="Debit Amount"/>
    </Column>
    <Column minScreenWidth="Medium" demandPopin="true" hAlign="Right">
      <Text text="Credit Amount"/>
    </Column>
    <Column hAlign="Right"> 
       <Text text="Balance"/>
    </Column>
    <Column minScreenWidth="Tablet" demandPopin="true" hAlign="Right">
       <Text text="Text"/>
    </Column>
  </columns>
</Table>

screenshot-12.pngscreenshot-11.pngscreenshot-8.png

Attachments

screenshot-12.png (219.6 kB)
screenshot-11.png (192.1 kB)
screenshot-8.png (181.2 kB)