Using the Query Picker

From Lianjapedia
Revision as of 02:29, 11 June 2018 by Barrymavin (Talk | contribs)

Jump to: navigation, search

To keep coding (NoCode) to a minimum there are many built-in WebViewWidgets that can be used with Lianja.showDialogPanel(), Lianja.showDialog() or as the URL in a WebView section or in a custom WebView object created with createObject("webview").

The Query Picker is a powerful WebViewWidget that incorporates the functionality of Miller columns and a searchable data grid. It also has integrated support for drilling down through data using the Query Builder.

A picture says a thousand words so let's look at the Query Picker then see how we can use it in our Apps.

You will typically want to show the Query Picker associated with a specific field in a form or canvas section. You can use the "Dialog Button" to achieve that.


Here the Query Picker will slide in from the right. You can of course have it slide in from the left and optionally animate across the whole of the UI viewport.


Clicking one of the "Search" icons in the column headers or the data grid header will show the Query Builder providing a powerfull means of drilling down through the data currently being queried.


Double clicking on a row in the data grid will select the column of your choice from the grid row and return back sliding the Query Picker out off the screen. You can specify a delegate to be called with one argument which is the value selected.

Let's now look at the ways we can activate the query picker and what parameters we can specify.

Query Picker Parameters


Parameter Description Default value
database southwind
table order_details
tabletitle The data grid header text Order Details
tablecolumns A comma separated list of columns to be displayed in the data grid
columncount The number of cascading list columns 2
columntitles A comma separated list of column titles Customers,Orders
datagrid The table, column list and foreign key for the data grid. Separate each of these with a vertical bar | order_details|*|orderid={}
selectcolumn The column to select in the data grid productid
columnsorderby The orderby for each column. Each item should be separated by a vertical bar |
orderby The orderby for for the data grid
showdatagrid If set to false only the miller columns are displayed true
showbadges If set to false no badge counts are calculated in the miller columns true
showbuttons If set to false no buttons are displayed in the footer true
buttons An optional comma separated list of buttons captions to be displayed in the footer
onbuttonclick The optional delegate to be called when a custom button is clicked. The delegate is called with two arguments, the button caption and the text of the selected data column.
onselect The optional delegate to be called when an item in the data grid is chosen. The delegate is called with two arguments, the column name selected in the data grid and the text of the selected data column.
delegatelib The optional name of the delegate library containing the delegates. This should be written in JavaScript for Web/Mobile Apps.

Query Picker Dialog

function myQueryPickerCallback(key, value)
    messageBox("You chose '"+value+"'");
var params = "";
var width = 900;
Lianja.showQueryPickerPanel("Browse Orders", "myQueryPickerCallback()", "southwind", "order_details", params, width);


You can have the Query Picker Panel slide in from the left by specifying a negative width e.g -900;


You can have the Query Picker Panel slide in and occupy the whole viewport by specifying a width of "100%".


Query Picker in a page

  • Create a new page
  • Add a WebView section
  • In the URL of the webview section specify a url that defines the WebViewWidget parameters as described above. e.g.

lib:/querypicker.rsp?dialogpanel=false&buttons=Approve,Deny,View Details&onbuttonclick=myButtonClick

Notice how you can define your own custom buttons and declare a callback to handle button clicks.

  • Add a function to the custom library for the section called myButtonClick which will be called when a row is selected in the data grid and a button is clicked
function myButtonClick(btntext, value)
    messageBox("You clicked the '"+btntext+"' button for '"+value+"'");


Now run you App in the browser.


Then drill down through the data and click a button.


So as you can see the Query Picker has a broad range of uses.