Passing variables to GraphQL proxy when loading data

A simpler question, part of the previous discussion on GraphQL: how should variables be passed to the GraphQL proxy when loading data in a widget like DataTable? I found a solution but I’m not sure it’s the recommended one.

For example, how would a custom currency be passed in this snippet?

Please check the related snippet: Code Snippet

You need to provide a valid GraphQL query and explicitly call the .load method of GraphQL proxy (not widget’s) with the required variables as the only parameter:

webix.proxy("GraphQL", `query($currency:String!){  
  rates(currency: $currency) { 
    name,
    currency,
    rate 
  }
}`)
.load({currency:"USD"})
.then(data => $$("grid").parse(data));

Or, you can go by a more sophisticated way and provide a url function for the Datatable widget with the above logic: https://snippet.webix.com/8xsl1po1

P.S. We do prepare an update on loading docs, as there non-covered options for both url and load: there can be a string, a function or an object(proxy) values for them.