The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojolicious::Plugin::DevexpressHelpers::Helpers - Helpers for Devexpress controls are defined here

VERSION

version 0.163572

SUBROUTINES/METHODS

out

Output string in template

        out '<div id="'.$id.'"></div>';

new

Internal usage.

        my $dxHelper = Mojolicous::Plugin::DevexpressHelpers::Helpers->new;
        $c->stash( dxHelper => $dxHelper );

indent_binding

        $dxHelper->indent_binding( 1 );

add_binding

Internal usage.

        $dxHelper->add_binding($binding, [$binding2,...] );

next_id

Internal usage.

        my $next_id_number = $dxHelper->next_id;

new_id

Internal usage.

        my $new_id = $dxHelper->new_id;

dxbind

Internal usage.

        dxbind( $c, 'dxButton' => $id => $attrs, \@extensions);

Produce a div tag with an computed id, which will be binded to a dxButton with $attrs attributs at call to dxbuild.

parse_attributs

Internal usage

        my $attrs = parse_attributs( $c, \@implicit_arguments, @attributs )

dxmenu $id, \@items ,[ \%options ]

        %= dxmenu mainMenu => [{ id => 1, text => 'Back', iconSrc => '/images/back.png', link => 'javascript:location.back();' }], \q% function(e){return e.itemData.link;} %

dxloadpanel [ $id, [ $message ] ], [ \%options ]

        %= dxloadpanel myLoadPanel => 'Please wait'

dxbutton [ $id, [ $text, [ $onclick ] ] ], [ \%options ]

        %= dxbutton myButtonId => 'My button' => q{ function (){ alert('onClick!'); } }
        
        %= dxbutton undef, 'My button' => '/some/url'
        
        %= dxbutton {
                        id      => myId,
                        text    => 'My button',
                        onClick => q{ function (){ alert('onClick!'); } },
                        type    => 'danger',
                        icon    => 'user'
                };

dxdatagrid [ $id, [ $datasource, ] ] [ \%opts ]

        %= dxdatagrid 'myID' => '/products.json', { columns => [qw( name description price )] }
        
        %= dxdatagrid undef, '/products.json'
        
        %= dxdatagrid { id => myId, dataSource => '/products.json' }

The following syntaxe allow to specify all options from a javascript object. Note: It will ignore all other options specified in the hash reference.

        %= dxdatagrid myId, { options => 'JSFrameWork.gridsOptions.myResource' }

dxform [ $id, [ $formData, [ \@itemsSpecs ], [ \%opts ] ] ]

        %= dxform myForm => \%formData;
        
        %= dxform myForm => \%formData, { colCount => 2 };
        
        %= dxform myForm => \%formData, \%itemsSpecs;
        
        %= dxform myForm => \%formData, \%itemsSpecs, { colCount => '3' };

dxpopup [ $id, [ $title, [ $contentTemplate, ] ] ], [\%opts]

        %= dxpopup myPopupID => 'Popup Title', \q{function(contentElement){
                        contentElement.append('<p>Hello!</p>');
                }};

mk_dxcontrol $dxControlName

In this package:

        mk_dxcontrol('dxNumberBox');
        mk_dxcontrol('dxSwitch');
        mk_dxcontrol('dxTextBox');
        mk_dxcontrol('dxLookup');
        mk_dxcontrol('dxSelectBox');

In your template:

        %= dxnumberbox 'age' => $value => 'Age: ', { placeHolder => 'Enter your age' }
        %= dxswitch 'mySwitch' => $boolean_value => 'Enabled: '
        %= dxtextbox 'name' => $value => 'Name: ', { placeHolder => 'Type a name' }
        %= dxlookup 'name' => $value => 'Name: ', { dataSource => $ds, valueExpr=> $ve, displayExpr => $de }
        %= dxselectbox 'name' => $value => 'Name: ', { dataSource => $ds, valueExpr=> $ve, displayExpr => $de }

dxbuild [ js_prefix = '$(function(){', js_sufix => '});' ]>

Build the binding between jQuery and divs generated by plugin helpers such as dxbutton. It is should to be called in your template just before you close the body tag. Optional named argument js_prefix and js_sufix can be specified to override standard javascript wrapper.

        <body>
                ...
                %= dxbuild
        </body>

require_asset @assets

Used to specify one or more assets dependencies, that will be appended on call to required_assets. This function need 'AssetPack' plugin to be configurated in your application.

in your template:

        <body>
                ...
                %= require_asset 'MyScript.js'
                ...
        </body>

in your layout:

        <head>
                ...
                %= required_assets
                ...
        </head>

required_assets

Add assets that was specified by calls to require_asset. See require_asset for usage.

prepend_js

Prepend javascript code to dx-generated code

        append_js 'alert("before dx-controls initialisation");'

append_js

Append javascript code to dx-generated code

        append_js 'alert("after dx-controls initialisation");'

register

Register our helpers

AUTHOR

Nicolas Georges <xlat@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Nicolas Georges.

This is free software, licensed under:

  The MIT (X11) License