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
125
WebDataGrid randomly filling rows on click
posted

We have a WebDataGrid on our site with 6 rows that is interactive and has buttons and such in the rows to load in data. For one of our clients (just one, works for everyone else), the grid seems to be pulling data from thin air when they click in it. They may click on a cell in one row, and another row will populate with data. There seems to be no rhyme or reason to it. Sometimes the data populates in the row they click on, sometimes it populates in another row.

Here is the code for the grid:

<ig:WebDataGrid ID="datagridChallenge" runat="server" AutoGenerateColumns="False" OnInitializeRow="datagridChallenge_InitializeRow" EnableDataViewState="True" DataKeyFields="DCKey">
    <EditorProviders>
        <ig:DatePickerProvider ID="DateInputProvider">
            <EditorControl runat="server" ClientIDMode="Predictable" DisplayModeFormat="d">
            </EditorControl>
        </ig:DatePickerProvider>
        <ig:DateTimeEditorProvider ID="TimeInputProvider">
            <EditorControl runat="server" ClientIDMode="Predictable" DisplayModeFormat="hh:mm tt" EditModeFormat="hh:mm tt">
            </EditorControl>
        </ig:DateTimeEditorProvider>
        <ig:NumericEditorProvider ID="NumericEditorProvider">
            <EditorControl runat="server" ClientIDMode="Predictable" DataMode="Decimal" MaxDecimalPlaces="0" MinDecimalPlaces="0">
            </EditorControl>
        </ig:NumericEditorProvider>
        <ig:DropDownProvider ID="DropDownProvider">
            <EditorControl ClientIDMode="Predictable" DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False" TextField="Type" ValueField="Type">
                <DropDownItemBinding TextField="Type" ValueField="Type" />
            </EditorControl>
        </ig:DropDownProvider>
    </EditorProviders>
    <Columns>
        <ig:BoundCheckBoxField CssClass="ColStop" DataFieldName="DCPause" Key="DCPause" Width="19px" ToolTipChecked="Unpause Challenge" ToolTipUnchecked="Pause Challenge">
            <Header CssClass="ColStopHeader">
            </Header>
        </ig:BoundCheckBoxField>
        <ig:BoundDataField DataFieldName="DCDesc" Key="DCDesc" Width="150px">
            <Header Text="Description">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCType" Key="DCType" Width="85px">
            <Header Text="Type">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCDate" Key="DCDate" Width="75px" DataType="System.DateTime" DataFormatString="{0:d}">
            <Header Text="Date">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCToDate" Key="DCToDate" Width="75px" DataType="System.DateTime" DataFormatString="{0:d}" Hidden="true">
            <Header Text="End Date">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCSTime" Key="DCSTime" Width="60px" DataType="System.DateTime" DataFormatString="{0:hh:mm tt}">
            <Header Text="Start">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCETime" Key="DCETime" Width="60px" DataType="System.DateTime" DataFormatString="{0:hh:mm tt}">
            <Header Text="End">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCFromVal" Key="DCFromVal" Width="70px">
            <Header Text="From/Parm">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCThruVal" Key="DCThruVal" Width="70px">
            <Header Text="Thru/Value">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCANumber" Key="DCANumber" Width="85px" DataType="System.Decimal" DataFormatString="{0:N0}" CssClass="Right">
            <Header Text="Number">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCAMonthly" Key="DCAMonthly" Width="85px" DataType="System.Decimal" DataFormatString="{0:C0}" CssClass="Right">
            <Header Text="Monthly">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCATotal" Key="DCATotal" Width="85px" DataType="System.Decimal" DataFormatString="{0:C0}" CssClass="Right">
            <Header Text="Total">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCGNumber" Key="DCGNumber" Width="85px" DataType="System.Decimal" DataFormatString="{0:N0}" CssClass="Right" Hidden="true">
            <Header Text="Number">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCGMonthly" Key="DCGMonthly" Width="85px" DataType="System.Decimal" DataFormatString="{0:C0}" CssClass="Right" Hidden="true">
            <Header Text="Monthly">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCGTotal" Key="DCGTotal" Width="85px" DataType="System.Decimal" DataFormatString="{0:C0}" CssClass="Right" Hidden="true">
            <Header Text="Total">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCDNumber" Key="DCDNumber" Width="85px" DataType="System.Decimal" DataFormatString="{0:N0}" CssClass="Right" Hidden="true">
            <Header Text="Number">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCDMonthly" Key="DCDMonthly" Width="85px" DataType="System.Decimal" DataFormatString="{0:C}" CssClass="Right" Hidden="true">
            <Header Text="Monthly">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCDTotal" Key="DCDTotal" Width="85px" DataType="System.Decimal" DataFormatString="{0:C}" CssClass="Right" Hidden="true">
            <Header Text="Total">
            </Header>
        </ig:BoundDataField>
        <ig:TemplateDataField Key="DCExpand" Width="21px">
            <ItemTemplate>
                <asp:ImageButton ID="btnExpand" runat="server" OnClientClick="ExpandChallenge(); return false;" ImageUrl="~/Images/Expand.png" ToolTip="Expand" />
            </ItemTemplate>
        </ig:TemplateDataField>
        <ig:TemplateDataField Key="DCSave" Width="21px">
            <ItemTemplate>
                <asp:ImageButton ID="btnSave" runat="server" OnClientClick="SvChallenge(); return false;" ImageUrl="~/Images/Save.png" ToolTip="Save" />
            </ItemTemplate>
        </ig:TemplateDataField>
        <ig:TemplateDataField Key="DCLoad" Width="21px">
            <ItemTemplate>
                <asp:ImageButton ID="btnLoad" runat="server" OnClientClick="LoadChallenge(); return false;" ImageUrl="~/Images/Load.png" ToolTip="Load Challenge" />
            </ItemTemplate>
        </ig:TemplateDataField>
        <ig:TemplateDataField Key="DCClear" Width="21px">
            <ItemTemplate>
                <asp:ImageButton ID="btnClear" runat="server" OnClientClick="ClearChallenge(); return false;" ImageUrl="~/Images/Stop.png" ToolTip="Clear Challenge" />
            </ItemTemplate>
        </ig:TemplateDataField>
        <ig:BoundDataField DataFieldName="DCID" Key="DCID" Width="50px">
            <Header Text="ID">
            </Header>
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="DCKey" Key="DCKey" Hidden="True">
            <Header Text="">
            </Header>
        </ig:BoundDataField>
    </Columns>
    <Behaviors>
        <ig:EditingCore>
            <Behaviors>
                <ig:CellEditing Enabled="true">
                    <ColumnSettings>
                        <ig:EditingColumnSetting ColumnKey="DCType" EditorID="DropDownProvider" />
                        <ig:EditingColumnSetting ColumnKey="DCDate" EditorID="DateInputProvider" />
                        <ig:EditingColumnSetting ColumnKey="DCToDate" EditorID="DateInputProvider" />
                        <ig:EditingColumnSetting ColumnKey="DCSTime" EditorID="TimeInputProvider" />
                        <ig:EditingColumnSetting ColumnKey="DCETime" EditorID="TimeInputProvider" />
                        <ig:EditingColumnSetting ColumnKey="DCANumber" ReadOnly="True" />
                        <ig:EditingColumnSetting ColumnKey="DCAMonthly" ReadOnly="True" />
                        <ig:EditingColumnSetting ColumnKey="DCATotal" ReadOnly="True" />
                        <ig:EditingColumnSetting ColumnKey="DCDNumber" ReadOnly="True" />
                        <ig:EditingColumnSetting ColumnKey="DCDMonthly" ReadOnly="True" />
                        <ig:EditingColumnSetting ColumnKey="DCDTotal" ReadOnly="True" />
                        <ig:EditingColumnSetting ColumnKey="DCID" ReadOnly="True" />
                        <ig:EditingColumnSetting ColumnKey="DCGNumber" EditorID="NumbericInputProvider" />
                        <ig:EditingColumnSetting ColumnKey="DCGMonthly" EditorID="NumbericInputProvider" />
                        <ig:EditingColumnSetting ColumnKey="DCGTotal" EditorID="NumbericInputProvider" />
                    </ColumnSettings>
                    <EditModeActions EnableOnKeyPress="True" MouseClick="Single" EnableOnActive="True" />
                </ig:CellEditing>
            </Behaviors>
        </ig:EditingCore>
        <ig:Selection RowSelectType="Single">
        </ig:Selection>
        <ig:Activation>
        </ig:Activation>
    </Behaviors>
</ig:WebDataGrid>

Every 15 seconds, we are making an AJAX call to update the data in the grid. When the call returns, I am checking the ID column to verify the row has not been cleared out and should therefore be updated. Here is the code for that call:

function SendChallengeInfo() {
    var Stamp = new Date();
    var Hours;
    var Mins;
    var Seconds;
    var Time;
    var chlist;
    var fndlist;
    var camp = getQueryVariable("CAMPCODE");

    chlist = "NONE";
    fndlist = "NONE";

    Hours = Stamp.getHours();
    Mins = Stamp.getMinutes();
    Seconds = Stamp.getSeconds();
    Time = (Hours * 10000) + (Mins * 100) + Seconds;
    Stamp = null;

    var grid = $IG.WebDataGrid.find("MainTab_tmpl0_datagridChallenge");
    var i;
    for (i = 0; i < grid.get_rows().get_length() ; i++) {
        var rw = grid.get_rows().get_row(i);

        if (rw.get_cell(ColCID).get_value() !== 0 && rw.get_cell(ColCPause).get_value() === false) {
            if (chlist === "NONE") {
                chlist = getchal(i) + ':' + rw.get_cell(ColCID).get_value();
            } else {
                chlist = chlist + '-' + getchal(i) + ':' + rw.get_cell(ColCID).get_value();
            }
        }
    }

    SendObj = GetAJAXObj();

    if (SendObj !== null) {
        SendObj.onreadystatechange = GetChallengeResponse;
        SendObj.open("Get", "FillChallenge.aspx?CAMPCODE=" + camp + "&LIST=" + chlist + "&FLIST=" + fndlist + "&UNIQUE=" + Time, true);
        SendObj.send(null);
    }

    return false;
}

function getchal(i) {
    switch (i) {
        case 0:
            return "C1";
        case 1:
            return "C2";
        case 2:
            return "C3";
        case 3:
            return "C4";
        case 4:
            return "C5";
        case 5:
            return "C6";
    }
    return "";
}

function GetChallengeResponse() {
    var headers;
    var details;
    var grid = $IG.WebDataGrid.find("MainTab_tmpl0_datagridChallenge");
    var rw;
    var divide = 1;
    var lblLoad;

    if (document.getElementById("MainTab_tmpl0_CBUseMonthly").checked) {
        divide = 12;
    }

    if (SendObj && SendObj.readyState === 4) {
        if (SendObj.status === 200) {
            headers = SendObj.responseText;
            if (SendObj.responseText.indexOf("ERROR") === -1) {
                headers = headers.split('#');

                for (var x = 0; x < headers.length; x++) {
                    details = headers[x].split('*');

                    switch (details[0]) {
                        case "C1":
                            rw = grid.get_rows().get_row(0);

                            if (rw.get_cell(ColCID).get_value().toString() === details[15]) {
                                updatechalgrid(rw, details);
                            }
                            break;
                        case "C2":
                            rw = grid.get_rows().get_row(1);

                            if (rw.get_cell(ColCID).get_value().toString() === details[15]) {
                                updatechalgrid(rw, details);
                            }
                            break;
                        case "C3":
                            rw = grid.get_rows().get_row(2);

                            if (rw.get_cell(ColCID).get_value().toString() === details[15]) {
                                updatechalgrid(rw, details);
                            }
                            break;
                        case "C4":
                            rw = grid.get_rows().get_row(3);

                            if (rw.get_cell(ColCID).get_value().toString() === details[15]) {
                                updatechalgrid(rw, details);
                            }
                            break;
                        case "C5":
                            rw = grid.get_rows().get_row(4);

                            if (rw.get_cell(ColCID).get_value().toString() === details[15]) {
                                updatechalgrid(rw, details);
                            }
                            break;
                        case "C6":
                            rw = grid.get_rows().get_row(5);

                            if (rw.get_cell(ColCID).get_value().toString() === details[15]) {
                                updatechalgrid(rw, details);
                            }
                            break;
                    }
                }
                setfunddata();
            } else {
                alert(SendObj.responseText);
            }
        }

        delete SendObj.onreadystatechange;
        SendObj = null;
    }
}

From what I've seen, it doesn't appear that the AJAX calls or updates have any relation to the data re-populating in the grid, as it seems to happen whenever they click on something. Have you ever heard of behavior like this? We think it may have something to do with their network or perhaps security programs installed on their computer, but so far we've gotten nowhere. We host their site on our cloud server, and we are able to pull up their page on our machines, but it behaves just fine for us, so that seems to rule out the server as the problem. Does the grid do any sort of caching that could become compromised?

Parents
No Data
Reply
  • 16310
    Offline posted

    Hi Dave,

    Thank you for posting in the Infragistics community and for the code and markup shared.

    I had a careful look and it seems fine. However I was not able to find any snippets that could show some ajax requests, etc. It seems the js code is not complete and issue may be caused by some code you have not shared. It is really hard to assume what may be causing the issue if further insight is not provided. Since it is working everywhere else then my very first guess is the browser used by your client or the .NET framework on the machine - there are cases when bugs in the .NET framework version cause our controls to behave in unexpected way in some scenarios.

    Please check on these. Otherwise I guess I would need a small sample that demonstrates the approach you are using to populate the grid, so that I can get a clear idea of the workflow.

Children
No Data