Configuring the Query Builder

You can configure the Query Builder in a number of ways. For a complete overview check out the Configuration options in the Developer Resources section.

Configure the Query Builder with a separate object

Create a configuration object with the properties you want to override.

<script type="text/javascript">
    var options = {
        definition: {
            operators : {
                different : {
                    label : 'MyCustomLabelDifferent',
                    description : 'My custom description...'
                }
            }
        }
    }
</script>

Add a configuration option object as the second argument of the JCSDLGui constructor

Alternatively, you can pass the Query Builder's configuration options as JavaScript Object literals on initialization. The example below hides all of the Facebook targets and the Amazon content target:

<script type="text/javascript">
var editor = new JCSDLGui($("#jcsdl"), {
        hideTargets : ['facebook', 'amazon.content']

});
</script>

If need be, you can use more than one instance of the Query Builder on the same page, each with a different configuration. For example, you could embed one Query Builder excluding all of the Facebook targets and another one without the Amazon content target.

<script type="text/javascript">

    var editor = new JCSDLGui("#jcsdl-wo-facebook", {
        hideTargets : ['facebook']
    });

    var editor2 = new JCSDLGui("#jcsdl-wo-amazon-content", {
        hideTargets : ['amazon.content']
    });

</script>

You can also use the Query Builder as a jQuery plugin. In this case, the Query Builder is initialized in the following way:

$('#jcsdl').jcsdlGui();

Once the plugin is initialized, you can use it in the following way:

$('#jcsdl').jcsdlGui('loadJCSDL', code);

Notes

Almost all data displayed inside the Query Builder (the list of targets, available operators, as well as some configuration options for the input fields) is defined inside the JCSDLDefinition object. It is possible to overwrite this object to suit your requirements using the Definition property in the configuration options.

If you are using parameters to modify default attributes of the Query Builder you can use the JCSDL.onLoad function. This function gathers the parameters, makes a proper queue for them, and prevents the Query Builder from calling the same parameter more than once.