Mantain PagingToolbar of Templated ComboBox Without Use Count

  1. #1

    Mantain PagingToolbar of Templated ComboBox Without Use Count

    Hi,

    I have the following code:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="TreeGridExample.WebForm3" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
    
        protected int TotalOnDemand
        {
            get { return Convert.ToInt32(ViewState["TotalOnDemand"]); }
            set { ViewState["TotalOnDemand"] = value; }
        }
    
        public class City
        {
            public int ID { get; set; }
            public string Name { get; set; }
        }
    
        private List<City> cities = new List<City>();
    
        protected void Page_Load(object sender, EventArgs e)
        {
            for (int i = 1; i < 15; i++)
            {
                cities.Add(new City { ID = i, Name = "City" + 1 });
            }
        }
    
        protected void _strCities_RefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            int contador = 0;
    
            IList<City> lst = cities.Skip(e.Start).Take(e.Limit).ToList();
    
            if (lst.Any())
            {
                contador = e.Start + e.Limit * 2;
    
                if (contador > TotalOnDemand)
                {
                    TotalOnDemand = contador;
                }
            }
            else
            {
                if (e.Start > 0)
                {
                    lst = new List<City> { new City() };
                }
                else
                {
                    TotalOnDemand = 0;
                }
            }
    
            _strCities.DataSource = lst;
            (this._strCities.Proxy[0] as PageProxy).Total = TotalOnDemand;
    
            _strCities.DataBind();
        }
        
    </script>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Store ID="_strCities" runat="server" AutoLoad="false" EnableViewState="true"
            OnRefreshData="_strCities_RefreshData">
            <DirectEventConfig ViewStateMode="Enabled" />
            <Proxy>
                <ext:PageProxy />
            </Proxy>
            <Reader>
                <ext:JsonReader IDProperty="ID">
                    <Fields>
                        <ext:RecordField Name="ID" Mapping="ID" Type="Int" />
                        <ext:RecordField Name="Name" Mapping="Name" Type="String" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <Listeners>
                <LoadException Handler="Ext.Msg.alert('Employees - Load failed', e.message || response.statusText);" />
            </Listeners>
        </ext:Store>
        <ext:ComboBox ID="_cbCities" runat="server" StoreID="_strCities" ViewStateMode="Enabled"
            FieldLabel="City" DisplayField="Name" ValueField="ID" TypeAhead="false" LoadingText="Retrieving Cities.."
            Width="400" PageSize="5" ItemSelector="tr.list-item" TriggerAction="Query" MinChars="1"
            AllowBlank="false">
            <Template ID="Template1" runat="server">
                <Html>
                    <tpl for=".">
                        <tpl if="[xindex] == 1">
                            <table class="cbStates-list">
                                <tr>
                                <th>ID</th>
                                <th>Name</th>
                            </tr>
                        </tpl>
                        <tr class="list-item">
                        <td style="padding:3px 0px;">{ID}</td>
                        <td>{Name}</td>
                        </tr>
                        <tpl if="[xcount-xindex]==0">
                            </table>
                        </tpl>
                    </tpl>
                </Html>
            </Template>
        </ext:ComboBox>
        </form>
    </body>
    </html>
    So, in this approach i can maintain the pagingtoolbar with one City with nothing on the final page, but i need a better approach:

    Maintain the pagingtoolbar without the empty City.

    I think, if manipulating the template i can do that, but i don't know how manipulate this, if you have any ideias?

    Thanks in advance,
  2. #2
    So, in this approach i can maintain the pagingtoolbar with one City with nothing on the final page, but i need a better approach:

    Maintain the pagingtoolbar without the empty City.
    Hi,

    I don't understand what do you mean.
    Please clarify.
    Last edited by Daniil; Oct 21, 2010 at 8:30 PM.
  3. #3

    Thread Solved

    Hi,

    Thanks, i already found other solution for this problem

Similar Threads

  1. Ext:PagingToolbar & ComboBox PageSize
    By cwolcott in forum 2.x Help
    Replies: 2
    Last Post: Mar 19, 2012, 10:55 PM
  2. Replies: 0
    Last Post: Oct 25, 2011, 11:02 AM
  3. How to change Page Count of PagingToolbar
    By ismailkocacan in forum 1.x Help
    Replies: 3
    Last Post: Jul 10, 2011, 6:54 PM
  4. Count items in a ComboBox?
    By Tbaseflug in forum 1.x Help
    Replies: 1
    Last Post: Nov 18, 2009, 12:25 PM
  5. Replies: 0
    Last Post: Oct 15, 2009, 6:39 AM

Posting Permissions