Excel and menu filtertypes do not work when grid is initialized without data

Using the example from the Grid - Getting Started page (http://docs.syncfusion.com/js/grid/getting-started), if I start out with an empty grid and then refresh the data the excel and menu filtertypes do not work.  After I assign a datasource (from another function that I call), I get the following error message: 

'Uncaught TypeError: n.render[((this.id + this._$colType) + "_listBox_Template")] is not a function'

Is there a work around for this behavior?

Code
window.gridData = [
        { firstName: "John", lastName: "Beckett", email: "[email protected]" },
        { firstName: "Ben", lastName: "Beckett", email: "[email protected]" },
        { firstName: "Andrew", lastName: "Beckett", email: "[email protected]" }
            ];



$("#Grid").ejGrid({
                //dataSource: window.gridData,
                allowFiltering: true,
                filterSettings: { filterType: "excel" },
                allowPaging: true,
                allowSorting: true,
                pageSettings: { pageSize: 5 },
               
                columns: [
                   { field: "firstName",headerText:"First Name" },
                   { field: "lastName", headerText: "Last Name" },
                   { field: "email", headerText: "Email" }
                ]              
                
            });

$("#Grid").ejGrid("dataSource", window.gridData);

3 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team September 4, 2015 07:24 AM UTC

Hi Jim,
Thanks for Contacting Syncfusion support.
When we bind an empty datasource, Grid cannot find the actual data type of a column. So, the mentioned issue occurred while filtering the column.
For this case, you have to set datatype for the column using type property.
We have a Knowledge Base for type property that you can refer from the following link:
 https://www.syncfusion.com/kb/3539/error-in-filter-menu-number-date-and-boolean-columns-have-incorrect-operators
Please find the sample from the following link:
Sample Link: http://www.syncfusion.com/downloads/support/forum/120126/ze/Html_Encode_Feature-944278058
Regards,
Prasanna Kumar N.S.V



JW Jim Woods September 10, 2015 03:49 AM UTC

Thank you.  That worked!


PK Prasanna Kumar Viswanathan Syncfusion Team September 11, 2015 04:36 AM UTC

Hi Jim,

We are happy that the provided details helped you.

Please let us know if you need any further assistance.

Regards,
Prasanna Kumar N.S.V

Loader.
Up arrow icon