How to convert below function in functional component ?

updateRule(args) { let predicate = this.qbObj.getPredicate(args.rule); if (isNullOrUndefined(predicate)) { this.gridObj.query = new Query().select(['TaskID', 'Name', 'Category', 'SerialNo', 'InvoiceNo', 'Status']); } else { this.gridObj.query = new Query().select(['TaskID', 'Name', 'Category', 'SerialNo', 'InvoiceNo', 'Status']) .where(predicate); } this.gridObj.refresh(); }


1 Reply

GK Gayathri KarunaiAnandam Syncfusion Team February 15, 2022 05:51 AM UTC

Hi Prasad, 

We have prepared a sample based on your requirement for querybuilder with data grid in functional component. Please check the below code snippet. 

Code: 
function updateRule(args) { 
    let predicate = this.getPredicate(args.rule); 
    if (isNullOrUndefined(predicate)) { 
      gridObj.current.query = new Query().select([ 
        "OrderID", 
        "CustomerID", 
        "EmployeeID" 
      ]); 
    } else { 
      gridObj.current.query = new Query() 
        .select(["OrderID", "CustomerID", "EmployeeID"]) 
        .where(predicate); 
    } 
    gridObj.current.refresh(); 
  } 
 

For your convenience, please check the below sample link. 


Please get back to us, if you need further assistance. 

Regards, 
Gayathri K 


Loader.
Up arrow icon