15
Webdatagrid is not filtering correctly. Version 17.2
posted

Hello everyone.
I am working with a program that reads from webservice, which is not in this program, a list, which contains three fields. All this from the client side. When I try to filter the information in the NameState field, the data disappears and displays the following error message: "SCRIPT2343: Stack overflow at line: 1". I have worked on the correction for some time and I can not find the solution, please, I thank in advance who can help me in the solution of it. Below the information about the program.

Code Behind:

Public Class WebForm1
Inherits System.Web.UI.Page
Public Shared ListadoTodosEstadosPais() As localhost.StatesbyCountry
'Public Shared ListadoTodosEstadosPais As DataTable
'Public Shared ListadoTodosEstadosPais As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim myService As localhost.WebGpsSrv = New localhost.WebGpsSrv()
ListadoTodosEstadosPais = myService.GetStatesByCountry0(0)
WDGPaises.DataSource = ListadoTodosEstadosPais.ToList
WDGPaises.DataBind()
WDGPaises.EnableClientRendering = True
End If
End Sub

End Class

javascript code


var grid;
var dataSource = [];
var WTELongitudDatasourceInitialize;
var WTEMensajeErrorInitialize;
function WTELongitudDatasource_Initialize(sender, eventArgs)
{
WTELongitudDatasourceInitialize = sender._id;
}

function WTECantidadRows_Initialize(sender, eventArgs)
{
WTECantidadRowsInitialize = sender._id;
}

function WTEMensajeError_Initialize(sender, eventArgs)
{
WTEMensajeErrorInitialize = sender._id;
}

function controlwdd(iid) {
var surlmain = 'http://localhost:32212/';
var urlroutine = 'WebGpsSrv.asmx/GetStatesByCountry';
var postData = { sCountry: iid };
$.ajax({
async: false,
type: "POST",
url: surlmain + urlroutine,
data: JSON.stringify(postData),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (data) {
alert(data.d);
}
});

function OnSuccess(data) {
grid = $find('WDGPaises');
if (dataSource.length > 0) {
dataSource.splice(0, dataSource.length);
}
//Show ajax loading
//dataGrid._pi.show(dataGrid);
//dataSource = dataGrid.get_dataSource();
var arr = $.parseJSON(data.d);
for (var i = 0; i < arr.length; i++) {
dataSource.push(arr[i]);
}
grid.set_dataSource(dataSource);
grid._applyClientBinding();
FillFieldsFromWDG(WTELongitudDatasourceInitialize, dataSource.length)
//dataGrid._pi.hide(dataGrid);
}
}

function WDGPaises_DataFiltering(sender, eventArgs)
{
//grid = $find("WDGPaises");
var filtering = grid.get_behaviors().get_filtering();
var columnFiltersInfo = filtering.get_columnFiltersInfo();
if (columnFiltersInfo.length > 0) {
try {
//// Set up column filter for OrderDate column
var columnFilter = filtering.create_columnFilter(columnFiltersInfo[0].KeyColumn);
////var condition = columnFilter.get_condition();
////condition.set_rule(columnFiltersInfo[0].Rule);
////condition.set_value(columnFiltersInfo[0].Value);
columnFilter.get_condition().set_value(columnFiltersInfo[0].Value);
columnFilter.get_condition().set_rule(columnFiltersInfo[0].Rule);
//// Create an array for the two filters
var columnFilters = new Array(columnFilter);
//// Add array of filters

filtering.add_columnFilter(columnFilter);
//filtering.addClientColumnFilter(columnFilter);
//var dataSource = grid.get_dataSource();
//grid.set_dataSource(dataSource);
var dataRows = grid.get_rows();
FillFieldsFromWDG(WTECantidadRowsInitialize, dataRows.get_length());
filtering.applyFilters();

} catch (err) {
FillFieldsFromWDG(WTEMensajeErrorInitialize, err.message + err.stack);
}
}
}

function WIBPrueba_Click(oButton, oEvent) {
var Id = prompt("Numero de país: ");
controlwdd(Id);
}

function WDGPaises_Sorting_ColumnSorting(sender, eventArgs)
{
//controlwdd(iiid);
//alert("Sorting");
}

function WDGPaises_Sorting_ColumnSorted(sender, eventArgs)
{
//grid = $find("WDGPaises");
// Sort column by calling sortColumn method and passing in the column and the sort direction
// Sort direction is 0, 1, or 2 for none, ascending, or descending.
grid.get_behaviors().get_sorting().sortColumn(grid.get_columns().get_columnFromKey("NameState"),2, false);
}

function FillFieldsFromWDG(FieldsTextEditor, FieldsWDG) {
$find(FieldsTextEditor).set_text(FieldsWDG);
}

HTML Mark up:


<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebPruebaWDG.WebForm1" %>

<%@ Register Assembly="Infragistics45.WebUI.WebDataInput.v17.2, Version=17.2.20172.2051, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.WebDataInput" TagPrefix="igtxt" %>

<%@ Register Assembly="Infragistics45.Web.v17.2, Version=17.2.20172.2051, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>

<%@ Register Assembly="Infragistics45.Web.v17.2, Version=17.2.20172.2051, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.Web.UI" TagPrefix="ig" %>

<%@ Register assembly="Infragistics45.Web.v17.2, Version=17.2.20172.2051, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.EditorControls" tagprefix="ig" %>

<!DOCTYPE html>

<html xmlns="">www.w3.org/.../xhtml">
<head runat="server">
<title>WebPruebaWDG</title>
<meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=edge" />
<script type="text/javascript" src="../Scripts/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../JS/jquery.tmpl.js"></script>
<script type="text/javascript" src="../JS/RoutinesWDG.js"></script>

<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style4 {
width: 278px;
}
</style>

</head>
<body>
<form id="form1" runat="server">
<div id="UpdPanel">
<ig:WebScriptManager ID="WSMPrueba" runat="server" EnablePartialRendering="true">
<Services>
<asp:ServiceReference Path="~/WebGpsSrv.asmx" />
</Services>
</ig:WebScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
<ContentTemplate>
<ig:WebDataGrid ID="WDGPaises" runat="server" Height="476px" Width="99%" AutoGenerateColumns="False" DataKeyFields="IdState" StyleSetName="Office2007Silver" StyleSetPath="~/ig_res">
<Columns>
<ig:BoundDataField DataFieldName="IdState" DataType="System.Int32" Key="IdState">
<Header Text="Estado">
</Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Country" DataType="System.Int32" Key="Country">
<Header Text="Pais">
</Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="NameState" DataType="System.String" Key="NameState">
<Header Text="Name">
</Header>
</ig:BoundDataField>
</Columns>
<Behaviors>
<ig:Activation>
</ig:Activation>
<ig:RowSelectors RowNumbering="True">
</ig:RowSelectors>
<ig:Selection CellClickAction="Row" CellSelectType="None" RowSelectType="Single">
</ig:Selection>
<ig:Filtering FilterRuleDropDownCssClass="igg_Office2007SilverFilterRuleDropDown" FilterRuleDropDownHoverItemCssClass="igg_Office2007SilverFilterRuleDropDownHoverItem" FilterRuleDropDownItemCssClass="igg_Office2007SilverFilterRuleDropDownItem" FilterRuleDropDownSelectedItemCssClass="igg_Office2007SilverFilterRuleDropDownSelectedItem">
<ColumnSettings>
<ig:ColumnFilteringSetting ColumnKey="IdState" Enabled="False" />
<ig:ColumnFilteringSetting ColumnKey="Country" Enabled="False" />
<ig:ColumnFilteringSetting ColumnKey="NameState" />
</ColumnSettings>
<FilteringClientEvents DataFiltering="WDGPaises_DataFiltering" />
</ig:Filtering>
<ig:Sorting>
<ColumnSettings>
<ig:SortingColumnSetting ColumnKey="NameState" />
</ColumnSettings>
<SortingClientEvents ColumnSorted="WDGPaises_Sorting_ColumnSorted" />
</ig:Sorting>
</Behaviors>
</ig:WebDataGrid>
<br />
<igtxt:WebImageButton ID="WIBPrueba" runat="server" Text="Prueba" AutoSubmit="False">
<ClientSideEvents Click="WIBPrueba_Click" />
</igtxt:WebImageButton>
<br />
<table class="auto-style1">
<tr>
<td class="auto-style4">Longitud datasource:</td>
<td>
<ig:WebTextEditor ID="WTELongitudDatasource" runat="server" Width="294px">
<ClientEvents Initialize="WTELongitudDatasource_Initialize" />
</ig:WebTextEditor>
</td>
</tr>
<tr>
<td class="auto-style4">Cantidad de Rows:</td>
<td>
<ig:WebTextEditor ID="WTECantidadRows" runat="server" Width="293px">
<ClientEvents Initialize="WTECantidadRows_Initialize" />
</ig:WebTextEditor>
</td>
</tr>
<tr>
<td class="auto-style4">Mensaje de Error:</td>
<td>
<ig:WebTextEditor ID="WTEMensajeError" runat="server" Width="894px" TextMode="MultiLine">
<ClientEvents Initialize="WTEMensajeError_Initialize" />
</ig:WebTextEditor>
</td>
</tr>
<tr>
<td class="auto-style4">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style4">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="WDGPaises" EventName="DataFiltering" />
<asp:AsyncPostBackTrigger ControlID="WDGPaises" EventName="ColumnSorted" />
<asp:AsyncPostBackTrigger ControlID="WIBPrueba" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

Parents Reply Children