EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rangaNadha on August 02, 2015, 03:47:19 AM



Title: Datagrid: Enable Filter giving error
Post by: rangaNadha on August 02, 2015, 03:47:19 AM
Hi,

I am trying to enable the filters for the datagrid. Using below code.
dataTable = $('.easyui-datagrid');
dataTable.datagrid('enableFilter');

I am facing the below error.
$.fn.datagrid.methods[_6ea]

Thanks in advance.


Title: Re: Datagrid: Enable Filter giving error
Post by: jarry on August 02, 2015, 05:41:05 PM
You have to create the datagrid component before calling methods.
Code:
dataTable.datagrid({...});  // create datagrid
dataTable.datagrid('enableFilter');


Title: Re: Datagrid: Enable Filter giving error
Post by: rangaNadha on August 03, 2015, 07:28:00 AM
In HTML:
<table id="usersTable" class="easyui-datagrid work_table work_table1" style="width: 100%; height: 98% !important"
            sortName="employeeNo" sortOrder="asc" rownumbers="false" pagination="true"
            data-options="singleSelect:true, onDblClickRow:userManagement.getDataById" url="userList.htm">
            <thead>
               <tr>
                  <th field="employeeNo" width="15%" sortable="true"><spring:message code="label.fuelmanagement.administration.employeeNo"/></th>
                        <th field="userId" width="12%" sortable="true" ><spring:message code="label.fuelmanagement.administration.userId"/></th>
                        <th field="userFName" width="10%" sortable="true" ><spring:message code="label.fuelmanagement.administration.userFName"/></th>
                        <th field="userMName" width="15%" sortable="true" ><spring:message code="label.fuelmanagement.administration.userMName"/></th>
                        <th field="userLName" width="15%" sortable="true" ><spring:message code="label.fuelmanagement.administration.userLName"/></th>
                  <th field="userRank" width="10%" sortable="true" ><spring:message code="label.fuelmanagement.administration.userRank"/></th>
                  <th field="englishTrade" width="10%" sortable="true"><spring:message code="label.fuelmanagement.administration.englishTrade"/></th>
                  <th field="userStatus" width="15%" sortable="true" ><spring:message code="label.fuelmanagement.administration.status"/></th>
               </tr>
            </thead>
            
         </table>

In JavaScript:
dataTable = $('.easyui-datagrid');
dataTable.datagrid('enableFilter');


Title: Re: Datagrid: Enable Filter giving error
Post by: jarry on August 03, 2015, 07:36:32 AM
Before calling the 'enableFilter' method, please include the 'datagrid-filter.js' file to your page. This file can be downloaded from http://www.jeasyui.com/extension/datagrid_filter.php. For more information please refer to this example http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem=DataGrid%20Filter%20Row


Title: Re: Datagrid: Enable Filter giving error
Post by: rangaNadha on August 03, 2015, 08:31:40 PM
I already included the /jquery.easyui.min.js file in our jsp.
I think it will contain the datagrid.js code also.
Correct me if i am wrong.


Title: Re: Datagrid: Enable Filter giving error
Post by: zolotoy on August 10, 2015, 09:09:35 AM
Were you able to figure it out? I too am getting the same error. Do you have pagination enabled?

Thanks