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
90
Calculate total rows selected in a Webdatagrid with paging using client side events
posted

Hi Team,

Please find the code below.

function GridResult_CellValueChanged(sender, e) {
if (e._cell._address == 0) {

CalculateTotalRecordSummary();
}
}

function CalculateTotalRecordSummary() {
let totalCount = 0;
try {

alert(document.getElementById("HFRowCount").value);

for (var i = 0; i < InfragisticJsUtil.WebDataGrid.GetRowCount('GridResult') ; i++) {
if (InfragisticJsUtil.WebDataGrid.GetSpecificCellValue('GridResult', i, 0) == true) {
totalCount += 1;
}
}
}
catch (e) {
setTimeout(function () { CalculateTotalRecordSummary(); }, 3000);
}
finally {

document.getElementById('selectedRecord').innerHTML = totalCount;

}
}

<igGridControls:WebDataGrid ID="GridResult" runat="server" Width="100%" Height="400" AutoGenerateColumns="false" DataKeyFields="som_id"
EnableDataViewState="true" EnableViewState="true" ClientEvents-Click="viewStatement" OnRowUpdating="GridResult_RowUpdating">
<EditorProviders>
<igGridControls:DropDownProvider ID="finalApprover">
<EditorControl DataKeyFields="full_nm" TextField="final_approver" ValueField="pal_id" EnableRenderingAnchors="false" EnableCustomValues="true" EnableAutoCompleteFirstMatch="true" Width="130px">
<DropDownItemBinding TextField="full_nm" ValueField="pal_id"></DropDownItemBinding>
</EditorControl>
</igGridControls:DropDownProvider>
<igGridControls:DropDownProvider ID="holdStatus">
<EditorControl DataKeyFields="system_code_desc" TextField="hold_status" ValueField="system_cd" EnableRenderingAnchors="false"
Width="160px" EnableCustomValues="true" EnableAutoCompleteFirstMatch="true">
<DropDownItemBinding TextField="system_code_desc" ValueField="system_cd"></DropDownItemBinding>
</EditorControl>
</igGridControls:DropDownProvider>
<igGridControls:DatePickerProvider ID="getDate">
</igGridControls:DatePickerProvider>
</EditorProviders>
<Columns>
<igGridControls:UnboundCheckBoxField Key="chk_box" Width="30px" HeaderCheckBoxMode="Off"></igGridControls:UnboundCheckBoxField>
<igGridControls:BoundDataField Key="som_id" DataFieldName="som_id" Hidden="true"></igGridControls:BoundDataField>
<igGridControls:BoundDataField Key="statement_period" DataFieldName="statement_period" Header-Text="Stmt Per" Width="90px"></igGridControls:BoundDataField>
<igGridControls:BoundDataField Key="group_id" DataFieldName="group_id" Hidden="true"></igGridControls:BoundDataField>
</Columns>
<EmptyRowsTemplate>
No records were found for the requested search.
</EmptyRowsTemplate>
<Behaviors>
<igGridControls:Paging Enabled="true" PagingClientEvents-PageIndexChanging="GridResult_PageIndexChanging" PagerAppearance="Bottom" PagerMode="NumericFirstLast" PageSize="50" ></igGridControls:Paging>

<igGridControls:EditingCore Enabled="true" AutoCRUD="false" >
<EditingClientEvents CellValueChanged="GridResult_CellValueChanged"/>
<Behaviors>
<igGridControls:CellEditing Enabled="true">
<ColumnSettings>
<igGridControls:EditingColumnSetting ColumnKey="chk_box" ReadOnly="false" />
<igGridControls:EditingColumnSetting ColumnKey="som_id" ReadOnly="true" />
<igGridControls:EditingColumnSetting ColumnKey="delivery_status_cd" ReadOnly="true" />
<igGridControls:EditingColumnSetting ColumnKey="delivery_status" ReadOnly="true" />
... so on
</ColumnSettings>
<EditModeActions MouseClick="Single" />
</igGridControls:CellEditing>
</Behaviors>
</igGridControls:EditingCore>
</Behaviors>
</igGridControls:WebDataGrid>

This code worked fine untill i enabled paging once paging is enabled on grid. The java script function CalculateTotalRecordSummary() is taking only the current page's selected row count. If i move to other page the previous pages selected count is lost.

I want the count of all the rows that are selected in all the pages of a grid in a client side event. Can someone please guide me on this.

Im using Infragistics version 11.2 and testing the application on IE.

Awaiting for updates. Please let me know if you need any further information.

Parents Reply Children
No Data