We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Grid search not working

Hi,
I'm trying to use search in syncfusion grid in VUE.

here is my grid:
        <ejs-grid ref='grid' id='grid' :dataSource="mmydata" :allowPaging='true' :allowSorting ='true' :sortSettings='initialSort'  :pageSettings='pageSettings' :editSettings='editSettings' :toolbar='toolbar' :actionBegin='actionBegin' :searchSettings='searchOptions' :allowExcelExport='false' :toolbarClick='toolbarClick' :actionFailure='actionFailure'  :contextMenuItems="contextMenuItems" >
            <e-columns>
                <e-column field='id' :lockColumn='true' :allowEditing='false' :visible='false' :isPrimaryKey='true' headerText='מזהה' width='100' textAlign='center' ></e-column>
                <e-column field='contract_id' headerText='שם המכרז' width='150' textAlign='right' :fields='cFields' editType='dropdownedit' :edit='editparams1' :dataSource='ccListdata' foreignKeyValue='contractName' foreignKeyField='id' :validationRules='requiredRule'></e-column>
                <e-column field='item_num' headerText='#סעיף' width='150' textAlign='right' :validationRules='requiredRule'></e-column>
                <e-column field='item_unit_id' headerText='יחידת מידה' width='150' textAlign='right' :fields='iuFields' editType='dropdownedit' :edit='editparams2' :dataSource='iiuListdata' foreignKeyValue='unitDescription' foreignKeyField='id' :validationRules='requiredRule'></e-column>
                <e-column field='description' headerText='תאור' width='200' textAlign='right' :validationRules='requiredRule'></e-column>
                <e-column field='quantity' headerText='כמות' width='150' textAlign='right'></e-column>
                <e-column field='item_price' headerText='עלות ליחידה' width='150' textAlign='right'></e-column>
                <e-column field='item_type_id' headerText='סוג פריט' width='150' textAlign='right' :fields='itFields' editType='dropdownedit' :edit='editparams3' :dataSource='iitListdata' foreignKeyValue='typeDescription' foreignKeyField='id' :validationRules='requiredRule'></e-column>
            </e-columns>
        </ejs-grid>

also i defined:
      searchOptions: {  fields: ['item_num', 'description'], operator: 'equal'},

my grid has 3 columns which are ForeignKey value loaded via ODataAdaptor, the main grid is WebApiAdaptor:

created() {
    this.ccListdata = new DataManager({headers: [{"X-CSRF-Token":  csrf_token}],url: '/contracts/?listOnly=1&',adaptor: new ODataAdaptor(), crossDomain: true});
    this.iiuListdata = new DataManager({headers: [{"X-CSRF-Token":  csrf_token}],url: '/itemunits/?listOnly=1&',adaptor: new ODataAdaptor(), crossDomain: true});
    this.iitListdata = new DataManager({headers: [{"X-CSRF-Token":  csrf_token}],url: '/itemtypes',adaptor: new ODataAdaptor(), crossDomain: true});
    this.mmydata = new DataManager(this.mydata);

  },
  computed: {
          mydata: function() {
            let $ak = {headers: [{"X-CSRF-Token":  this.getCsrfTOken()}],url: serviceURL+this.mycid, adaptor: new WebApiAdaptor()};
            return $ak;
          },
  },

unfutunatly when i issue a search i see in the dev tools that the search is forwared to the urls of the foreignkey columns and not to the url of the grid
http://127.0.0.1:8000/contracts/?listOnly=1&&$filter=(tolower(cast(contractName,%20%27Edm.String%27))%20eq%20%27121%27)
http://127.0.0.1:8000/itemunits/?listOnly=1&&$filter=(tolower(cast(unitDescription,%20%27Edm.String%27))%20eq%20%27121%27)
http://127.0.0.1:8000/itemtypes/?$filter=(tolower(cast(typeDescription,%20%27Edm.String%27))%20eq%20%27121%27)

Please Help me fix this annoying issue.

Sami

1 Reply

MS Manivel Sellamuthu Syncfusion Team October 31, 2019 02:45 PM UTC

Hi Sami, 

Thanks for contacting us. 

By default in Grid, while searching an individual query will be sent to foreignKey columns, even if we excluded the foreignKey columns in search settings. The query will be sent to get the matching records for the searched data(grid dataSource). This is the default behavior. Could you please share the following details that will help us to validate further at our end. 

  1. Share the screenshot of the issue or video demo
  2. Share the console error thrown, if any.
  3. Bind actionFailure event for the grid and share the stacktrace (if any).
  4. Please explain more about the issue you are facing

Please share the above details, that will help us to validate the issue and provide a solution as soon as possible. 

Regards, 
Manivel 


Loader.
Live Chat Icon For mobile
Up arrow icon