When I intitialize an igGrid, I bind an event handler to the rowSelectionChanged event. I also set dataSourceUrl to a remote data source. This works perfectly.
I then add a call to dataBind to refresh the data. This refresh happens periodically. After that, each time a row is clicked, the event handler gets called multiple times. The more refreshes that happen, the more times the event handler will get called for a row click. Is this expected behavior? How can I work around this behavior?
Thanks in advance for your help.
Kevin
Hello Kevin,
Where do you add the dataBind call? Do you add it within the rowSelectionChanged event? Could you provide me with an isolated sample that reproduces the issue or share a code snippet in order to be able to replicate your scenario on my side.
Waiting for your reply.
Regards,
Tsanna
I add the dataBind call to a function that gets invoked periodically.
Grid definition / initialization:
@(Html.Infragistics().Grid<REXViewerRazor.Models.ComputerStepStatus>()
.ID("grid1")
.Width("100%")
.AutoGenerateColumns(false)
.Columns(column =>
{
column.For(x => x.ComputerName).DataType("string").HeaderText("Computer Name");
column.For(x => x.ComputerStatus).DataType("string").HeaderText("Computer Status");
column.For(x => x.StepNumber).DataType("number").HeaderText("Step Number");
column.For(x => x.StepName).DataType("string").HeaderText("Step Name");
column.For(x => x.StepStatus).DataType("string").HeaderText("Step Status");
})
.DefaultColumnWidth("150px")
.Features(feature =>
feature.Responsive()
.EnableVerticalRendering(false)
.ReactOnContainerWidthChanges(true);
feature.Sorting().Type(OpType.Local).Mode(SortingMode.Single);
feature.Selection().Mode(SelectionMode.Row).AddClientEvent("rowSelectionChanged", "rowSelectionChangedHandler");
.DataSourceUrl(Url.Action("GetComputerStepStatus", "RexViewer", new { jobID = ViewBag.JobID }))
.DataBind()
.Render()
)
databind call:
var myVar = setInterval(function () { myTimer() }, 10000);
function myTimer() {
$("#grid1").igGrid("dataBind");
}
I prepared a small sample similar to your scenario in order to test the behavior that you're describing, however I was unable to reproduce the issue. Could you tell me what is the version of Ignite UI controls that you're currently using? At the meantime I'm sending my sample for your reference. If you need further assistance, please let me know.
Did you manage to resolve your issue? If you need further assistance, please let me know.
Hi Tsanna,
Unfortunately that solution did not work for me. My version is below. The major difference I see is the use of dataSourceUrl vs. dataSource. I am using version 14.2.20142.1024
$(function () {
createCellSelectionGrid();
});
function createCellSelectionGrid() {
$("#computer_step_status_h2").show();
$("#grid1").igGrid({
width: "100%",
autoGenerateColumns: false,
columns: [
{ headerText: "Computer Name", key: "ComputerName", dataType: "string" },
{ headerText: "Computer Status", key: "ComputerStatus", dataType: "string" },
{ headerText: "Step Number", key: "StepNumber", dataType: "number" },
{ headerText: "Step Name", key: "StepName", dataType: "string" },
{ headerText: "Step Status", key: "StepStatus", dataType: "string" }
],
features: [
name: 'Responsive',
enableVerticalRendering: false,
reactOnContainerWidthChanges: true
},
name: "Sorting",
type: "local",
mode: "single"
name: "Selection",
mode: "row",
rowSelectionChanged: rowSelectionChangedHandler
defaultColumnWidth: "150px",
dataSourceUrl: "@Url.Action("GetComputerStepStatus", "RexViewer", new { jobID = ViewBag.JobID })"