check whether there are records in the dataview store from the xtemplate

  • Hi guys,
    How can I determine whether there are records in the store from an xtemplate for dataview? I want to display alternative text in case the dataview is empty, for instance: "NO RECORDS TO DISPLAY", or something like that.


  • thanks a lot, the first part of your post is exactly what I need.


  • vmihaylov -

    There is a configuration option of DataView called emptyText which will give you the desired functionality. Simply put the emptyText config in your DataView constructor and if no records are found it will display that.

    Example:

    var dv = new Ext.DataView({
    emptyText: 'NO RECORDS TO DISPLAY',
    // addl configs
    });


    To answer the initial question, to check to see if there any records you would simply check the datastore directly. You can access it through the store property of a dataview and use the getCount method.

    Example:

    var count = dv.store.getCount();







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about check whether there are records in the dataview store from the xtemplate , Please add it free.

    7 January 2009 | cameltoepants.com | edit