Widget starting with binding 'query'

I want to use a widget which definition starts with binding 'query'. When I try to compile the following

 'start' ( )
	query 'User'
		from path .'Users'
		limit: 1000 / 1000 / 1000 [
			'username' '' -> : text 'Username'
		]
	// the widget in question
	'query table.alan' {
		...
	}

It gives the this error:

equality constraint violation for 'client binding check':
	- expected:  /'node' of type 'client_bindings'::'bindings'
	 at /home/coder/project/systems/siknon/../../.alan/devenv/system-types/webclient/client.lib/client_bindings.alan:1:1 to 1:1
	- but found: /'query' of type 'client_bindings'::'bindings'
	 at /home/coder/project/systems/siknon/../../.alan/devenv/system-types/webclient/client.lib/client_bindings.alan:1:1 to 1:1

Is it possible to use such widgets directly in a view or are they ment to be used in some other way?

Views always start with the node binding. In your example that would be the root node of the application. The query table widget start with a ‘query’ binding. You could either wrap the widget in another widget that changes the context to a query or you could add the query binding to the query table and start from the node.

In your case I would suggest the first, because you would need to rewrite a lot of the query table. The view should look like this:

'query context.alan'{
	'query':: query 'User' {
		'widget': widget 'query table.alan' { }
	}
}

And the implementation of query context.alan is:

binding 'node' {
	'query': binding 'query' {
		'widget': widget
	}
}
::'query' widget 'widget'

Hope this helps!

1 Like

It worked. Thank you!