DHTMLX::Connector - DHTMLX Perl connector
SYNOPSIS
use DHTMLX::Connector;
# Instantiating DHTMLX::Connector object
my $connector = DHTMLX::Connector->new();
# table name
my $table = "tbl_person";
# table primary key
my $primary_key = "id";
use Tie::IxHash;
# hash containing columns information that will be parsed on grid
my %columns;
# order hash by insertion order
tie %columns, "Tie::IxHash";
# Nome,operador,tipagem das columns que serão parseadas no módulo
$columns{id} = {operator => "=", type => "inteiro" };
$columns{name} = {operator => "ILIKE", type => "string" };
$columns{last_name} = {operator => "ILIKE", type => "string" };
$connector->jsonForGrid( $table, $primary_key, \%columns );
$connector->xmlForGrid( $table, $primary_key, \%columns );
DESCRIPTION
# provides data to feed DHTMLX components like Grid, TreeGrid, Tree, Combo, Scheduler, DataView, Chart, Form
# provides Server side sorting and filtering for Grid, Combo
# provides dynamic loading (paging) for Grid, Treegrid, Tree, Scheduler, DataView
# fully supported DataBases: PostgreSQL, MSSQL
ABSTRACT
NAME
CommerceManager::Connector
VERSION
version 0.001
SYNOPSIS
Exemplo de uso
use CommerceManager::Core;
use CommerceManager::Usuario;
use CommerceManager::Connector;
$Response->{charset}="utf-8";
my $core = new CommerceManager::Core($Request, $Response, $Server);
my $usuario = new CommerceManager::Usuario();
# verifica se ta logado, senao reload window pai para /extranet
$usuario->checklogin();
my $user_id = $usuario->id();
my $user_group = $usuario->grupo();
# string nome da table no DB representada por esse módulo
my $table = "tbl_imoveis";
# string nome da chave primária da table
my $primary_key = "id";
# String delimitada por | contendo Nome,operador,tipagem das columns que serão parseadas no módulo
my $columns = "id,=,int|titulo,ILIKE,str|codref,=,int|dvalor,=,cur";
# *opcional* string nome da coluna que relaciona os registros ao user logado
my $identifies_column = "idcorretor";
# opcional inteiro número de registros por página à cada requisicao da grid on evento onscroll
my $numRegPag;
# opcional booleano 1/0 - habilita desabilita smartrendering
my $isSmartRendering;
# toda vez que a grid solicitar a estrutura JSON ela passará como parâmetro na URL o valor booleano javascript sobre o estado do smart rendering
if($core->Get("smartRendering") eq "true")
{
# como o method .load da versao free nao permite dynamic smartrendering, setamos um valor máximo de registros que serão parseados
# caso seja esteja usando uma versao paga, aconselhavel diminuir esse valor pois o dynamic smartrendering estará habilitado. Ex.: 50
$numRegPag = 10000;
# habilita smartrendering
$isSmartRendering = 1;
}
else
{
undef($numRegPag);
# desabilita smartrendering
undef($isSmartRendering);
}
# parâmetros obrigatórios -> $table, $primary_key, $columns
# execucao minima -> new CommerceManager::Connector($table, $primary_key, $columns, undef($identifies_column), undef($isSmartRendering), undef($numRegPag))
my $modulo = new CommerceManager::Connector($table, $primary_key, $columns, $identifies_column, $isSmartRendering, $numRegPag);
# imprime estrutura JSON contendo dados para alimentar a grid
$modulo->json();
METHODS
json
$modulo->json();
Gera JSON que alimenta a grid do tipo DHTMLXGrid
RESPONSE FORMAT
Smart Rendering enabled
{
total_count:50000,
pos:0,
rows:[
{ id:1002,
selected:true, // seleciona linha
style:"color:red;", // atribui estilo
userdata:{"name1":"ud1","name2":"ud2"}, // seta user data
data:[
"1000",
"Blood and Smoke", {"value":"Stephen King","type":"ed"}, // muda tipo de célua
]
}
]
}
Smart Rendering disabled
data ={
rows:[
{ id:1002,
selected:true, // seleciona linha
style:"color:red;", // atribui estilo
userdata:{"name1":"ud1","name2":"ud2"}, // seta user data
data:[
"1000",
"Blood and Smoke", {"value":"Stephen King","type":"ed"}, // muda tipo de célua
]
}
]
}
EXAMPLES
AUTHORS
José Eduardo Perotta de Almeida, eduardo at web2solutions.com.br
LICENSE AND COPYRIGHT
Copyright 2011 José Eduardo Perotta de Almeida.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests through the web interface at http://rt.cpan.org.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.