WebCombo filter on client

5 replies. Last post: October 10, 2013 11:24 PM by Hans Kristian
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
luwen zhangMember
I used a WebCombo inside a grid. Everything works fine except the speed of loading the options in webcombo is slow when user start to type.  Here is the code

<ISWebCombo:WebCombo ID="WebCombo1" runat="server" OnInitializeDataSource="WebCombo1_InitializeDataSource UseDefaultStyle="True" Width="350px" >      <LayoutSettings EntryMode="AutoComplete"> </LayoutSettings>         
</ISWebCombo:WebCombo>


So I changed to use JSON and clientBindering.  The problem is that  the options in webcombo are not filtered as they are supposed to when user start typing.

This is the format options in WebCombo.  They contains two parts: number and description. For example: 
1 - U.S. Government Interest Reported as Nonqualified Dividends
2 - U.S. Corporate Dividends from Foreign Source
3 - Foreign Dividends
12 - Partnership Income
123 - Exempt Interest Subject to AMT - Territories

What I want is when user types "1", all options starting with "1" are shown, 
1 - U.S. Government Interest Reported as Nonqualified Dividends
12 - Partnership Income
123 - Exempt Interest Subject to AMT - Territories

When user types 12, all options starting with "12" are shown
12 - Partnership Income
123 - Exempt Interest Subject to AMT - Territories
124 - xxxx

but now it always shows everything in the order of the list without filtering
1 - U.S. Government Interest Reported as Nonqualified Dividends
2 - U.S. Corporate Dividends from Foreign Source
3 - Foreign Dividends


My question is 
1. How to apply filter to the webcombo options in javascript ?
2. If (1) is not applicable, how to speed up the combo options loading?

Here is my code.

<ISWebCombo:WebCombo ID="WebCombo1" runat="server" DataTextField="text" DataValueField="key" BindingOperationMode="ClientBinding" UseDefaultStyle="True"  >
    <Columns>
        <ISWebCombo:WebComboColumn Name="text" BaseFieldName="text" HeaderText="Item Text" Width="350"/>
    </Columns>                                                            
    <LayoutSettings EntryMode="AutoComplete"  ComboMode="SingleColumn" StatusBoxVisible="true" AlwaysShowAllRowsOnDropdown="false" />
    <FlyPostBackSettings PostHiddenFields="true" PostInputControls="true" />
     <ClientBindingSettings DataSourceType="ClientDataSource" /> 
</ISWebCombo:WebCombo>


    <script type="text/javascript">

        function BindWebCombo() {  // called when page load
            var combo = ISGetObject("WebCombo1");
            var webComboTable = new ISDataTable();
            var keyColumn = new ISDataColumn(webComboTable);
            var textColumn = new ISDataColumn(webComboTable);

            webComboTable.Name = webComboTable.TableName = "TaxCodesDesc ";
            keyColumn.Name = keyColumn.ColumnName = "key";
            textColumn.Name = textColumn.ColumnName = "text";

            webComboTable.Columns.Add(keyColumn);
            webComboTable.Columns.Add(textColumn);

            for (var j = 0; j < retData.TaxCodesDesc.length; j++) {           
                var dataRow = webComboTable.NewRow();
                dataRow.Cells.GetNamedItem("key").Value = retData.TaxCodesDesc[j].key;
                dataRow.Cells.GetNamedItem("text").Value = DecodeXmlText(retData.TaxCodesDesc[j].value);
                webComboTable.Rows.Add(dataRow);
            }

            combo.SetDataSource(webComboTable);
            combo.DataBind();
            combo.Render();
            combo.ShowDropDown();
        }
</script>


Thanks,
Luwen



All times are GMT -5. The time now is 5:24 PM.
Previous Next