LookupPickerField in FieldGroup

If we use optionsDatasource we get lookupField in the fieldGroup that I have been using frequently. However, How can we get the LookupPickerField instead inside a fieldGroup?

<vbox id="fieldGroupBox">
    <fieldGroup id="fieldGroup"
        <column width="250px">
            <field id="resourceCode"/>
            <field id="name"/>
            <field id="factory"
            <field id="resourceGroup"
            <field id="factoryProductionStage"
1 Like

I Think you can create this in the java code like this:

private PickerField countryField;

public void init(java.util.Map<java.lang.String, java.lang.Object> params) {

There i have created one entity Country. And an entity for Customer, customer has an ASSOCIATION to Country.
The default is a LookupField. Now in the code you can add features like Lookup, Open and Clear.

Is it what you want?

Yes, this is what I was looking for. Thank you so much.

is this possible with a table somehow as well?


If you mean an editable table, then yes - use the addGeneratedColumn() method. See an example of using this method here.

1 Like

Hi Konstantin,

yeah, that’s exactly what I needed! It works perfectly. :slight_smile:



I use the same code as the example, but when I run the programm I get the following error:

com.haulmont.cuba.core.sys.javacl.compiler.CharSequenceCompilerException: Compilation failed. Causes: 
OrderEdit.java:11: error: cannot find symbol
    private PickerField clientField;
  symbol:   class PickerField
  location: class com.company.workshop.web.order.OrderEdit OrderEdit.java:10: error: cannot find symbol
  symbol:   class Named
  location: class com.company.workshop.web.order.OrderEdit 
	at com.haulmont.cuba.core.sys.javacl.compiler.CharSequenceCompiler.compile(CharSequenceCompiler.java:178)
	at com.haulmont.cuba.core.sys.javacl.JavaClassLoader.loadClass(JavaClassLoader.java:167)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:677)

I miss to import a class or library ?

These are my imports:

package com.company.workshop.web.order;

import javax.inject.Inject;
import com.company.workshop.entity.OrderStatus;
import com.company.workshop.service.OrderService;
import com.haulmont.cuba.gui.components.AbstractEditor;
import com.company.workshop.entity.Order;

public class OrderEdit extends AbstractEditor<Order> {
    private PickerField clientField;

Try recreate the ItelliJ files from Cuba Studio.

at this time I am not using intelliJ, I use only cuba studio editor.
After that, I closed the studio etc and restart again, then I tried to start the application server and I got again the following errors:

[22:27:35.290] Ready
[22:28:11.865] Restarting the application server
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead. 
at build_6jo8oxswb1bewvutm0guna9l3$_run_closure4.doCall(C:\Users\George\studio-projects\workshop\build.gradle:88) 
:app-core:assembleDbScripts UP-TO-DATE 
:app-core:dbScriptsArchive UP-TO-DATE 
:app-global:compileJavaNote: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.  
:app-global:processResources UP-TO-DATE 
:app-core:processResources UP-TO-DATE 
:app-core:jar UP-TO-DATE 
:app-core:sourceJar UP-TO-DATE 
:app-core:assemble UP-TO-DATE 
:app-gui:compileJava UP-TO-DATE 
:app-gui:processResources UP-TO-DATE 
:app-gui:classes UP-TO-DATE 
:app-gui:jar UP-TO-DATE 
:app-web:compileJavaC:\Users\George\studio-projects\workshop\modules\web\src\com\company\workshop\web\order\OrderEdit.java:11: error: cannot find symbol
     private PickerField clientField;
	 ^   symbol:   class PickerField
	 location: class OrderEdit 
C:\Users\George\studio-projects\workshop\modules\web\src\com\company\workshop\web\order\OrderEdit.java:10: error: cannot find symbol
	 ^   symbol:   class Named
	 location: class OrderEdit 
2 errors

  FAILURE: Build failed with an exception.  
 * What went wrong: Execution failed for task '
> Compilation failed; see the compiler error output for details.  

* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.  BUILD FAILED  Total time: 25.979 secs [22:28:39.052] Task 'deploy, start' failed

Compilation failed; see the compiler error output for details.

I would recommend using IntelliJ community. It will help you solve any import errors.
If you want me to help you further, you have to upload the project without the build folder.

Thank you Kjell,

I am new in cuba, and tried the example
I will search a litle and maybe I will make a new question.

Finally and after following your suggestions, I was able to setup IntelliJ and it suggested me the missing import!

import com.haulmont.cuba.gui.components.PickerField;

I searched a lot and I did not find the import statment for the PickerField, also not at the specific pages for this contol.



Thanks a lot Kjell

1 Like

This page may help you to see how the controllers can be used.
[Sampler page] (https://demo.cuba-platform.com/sampler/#!)

Look at the spure tab for xml or java.


Studio is not aimed at normal Java development. Please always use Eclipse or Intellij for your business logic development. You can easily go to the IDE using Ctrl + I shortcut in the Screen Designer or using IDE buttons in the navigation panel.

1 Like