É um componente de contêiner genérico que pode sobrepor outros componentes na página. Características notáveis são posicionamento personalizado, eventos e efeitos configuráveis. O carregamento lento de conteúdo para reduzir o tempo de carregamento da página também é compatível com a opção dinâmica, quando habilitada o Painel carregará o conteúdo pouco antes de ser mostrado.
if($render[0]=='moviePicker'){
$resposta='
<div id="moviesGrid" class="ui-datatable ui-widget">
<div id="paginator_top" class="ui-paginator ui-paginator-top ui-widget-header ui-corner-top" role="navigation" aria-label="Pagination"><a href="#" class="ui-paginator-first ui-state-default ui-corner-all ui-state-disabled" aria-label="First Page" tabindex="-1"><span class="ui-icon ui-icon-seek-first">F</span></a><a href="#" class="ui-paginator-prev ui-state-default ui-corner-all ui-state-disabled" aria-label="Previous Page" tabindex="-1"><span class="ui-icon ui-icon-seek-prev">P</span></a><span class="ui-paginator-pages"><a class="ui-paginator-page ui-state-default ui-state-active ui-corner-all" tabindex="0" href="#">1</a><a class="ui-paginator-page ui-state-default ui-corner-all" tabindex="0" href="#">2</a><a class="ui-paginator-page ui-state-default ui-corner-all" tabindex="0" href="#">3</a></span><a href="#" class="ui-paginator-next ui-state-default ui-corner-all" aria-label="Next Page" tabindex="0"><span class="ui-icon ui-icon-seek-next">N</span></a><a href="#" class="ui-paginator-last ui-state-default ui-corner-all" aria-label="Last Page" tabindex="0"><span class="ui-icon ui-icon-seek-end">E</span></a></div>
<div class="ui-datatable-tablewrapper">
<table role="grid">
<thead id="moviesGrid_head">
<tr role="row">
<th class="ui-state-default" role="columnheader" aria-label="Filme" scope="col"><span class="ui-column-title">Filme</span></th>
<th class="ui-state-default" role="columnheader" aria-label="Dirigido por" scope="col"><span class="ui-column-title">Dirigido por</span></th>
<th class="ui-state-default" role="columnheader" aria-label="Genero" scope="col"><span class="ui-column-title">Genero</span></th>
<th class="ui-state-default" role="columnheader" aria-label="Duração(min.)" scope="col"><span class="ui-column-title">Duração(min.)</span></th>
</tr>
</thead>
<tbody id="moviesGrid_data" class="ui-datatable-data ui-widget-content" tabindex="0">';
$result = "SELECT * FROM filmes LIMIT 5";
$result = $pdo->query($result);
while ($linha = $result->fetch(PDO::FETCH_ASSOC)){
$resposta.='<tr data-ri="'.$linha['id_filme'].'" data-rk="'.$linha['filme'].'" class="ui-widget-content ui-datatable-even ui-datatable-selectable" role="row" aria-selected="false">
<td role="gridcell" class="">'.$linha['filme'].'</td>
<td role="gridcell" class="">'.$linha['diretor'].'</td>
<td role="gridcell" class="">'.$linha['genero'].'</td>
<td role="gridcell" class="">'.$linha['tempo'].'</td>
</tr>';
}
$resposta.='
</tbody>
</table>
</div>
<div id="paginator_bottom" class="ui-paginator ui-paginator-bottom ui-widget-header ui-corner-bottom" role="navigation" aria-label="Pagination"><a href="#" class="ui-paginator-first ui-state-default ui-corner-all ui-state-disabled" aria-label="First Page" tabindex="-1"><span class="ui-icon ui-icon-seek-first">F</span></a><a href="#" class="ui-paginator-prev ui-state-default ui-corner-all ui-state-disabled" aria-label="Previous Page" tabindex="-1"><span class="ui-icon ui-icon-seek-prev">P</span></a><span class="ui-paginator-pages"><a class="ui-paginator-page ui-state-default ui-state-active ui-corner-all" tabindex="0" href="#">1</a><a class="ui-paginator-page ui-state-default ui-corner-all" tabindex="0" href="#">2</a><a class="ui-paginator-page ui-state-default ui-corner-all" tabindex="0" href="#">3</a></span><a href="#" class="ui-paginator-next ui-state-default ui-corner-all" aria-label="Next Page" tabindex="0"><span class="ui-icon ui-icon-seek-next">N</span></a><a href="#" class="ui-paginator-last ui-state-default ui-corner-all" aria-label="Last Page" tabindex="0"><span class="ui-icon ui-icon-seek-end">E</span></a></div><input id="moviesGrid_selection" name="moviesGrid_selection" type="hidden" autocomplete="off" aria-hidden="true" value="" />
</div> <script id = "moviesGrid_s" type = "text/javascript" >
DinarteCoelho.cw("DataTable", "widget_moviesGrid", {
id: "moviesGrid"
, paginator: {
id: [\'paginator_top\', \'paginator_bottom\']
, rows: 5
, rowCount: 12
, page: 0
, currentPageTemplate: \'({currentPage} of {totalPages})\'
}
, selectionMode: "single"
, groupColumnIndexes: []
, disableContextMenuIfEmpty: false
, behaviors: {
rowSelect: function (ext, event) {
DinarteCoelho.ab({
s: "moviesGrid"
, e: "rowSelect"
, f: "formulario"
, p: "moviesGrid"
, u: "alerta"
, onco: function (xhr, status, args, data) {
DC(\'widget_moviePicker\')
.hide();
}
}, ext);
}
}
});
</script>
';
}
if($render[0]=="moviesGrid"){
$inicio= $_POST['moviesGrid_first'];
$limit= $_POST['moviesGrid_rows'];
$resposta='';
$result = "SELECT * FROM filmes LIMIT ".$inicio.",".$limit;
$result = $pdo->query($result);
while ($linha = $result->fetch(PDO::FETCH_ASSOC)){
$resposta.='
<tr data-ri="'.$linha['id_filme'].'" data-rk="'.$linha['filme'].'" class="ui-widget-content ui-datatable-even ui-datatable-selectable" role="row" aria-selected="false">
<td role="gridcell" class="">'.$linha['filme'].'</td>
<td role="gridcell" class="">'.$linha['diretor'].'</td>
<td role="gridcell" class="">'.$linha['genero'].'</td>
<td role="gridcell" class="">'.$linha['tempo'].'</td>
</tr>
';
}
}
if($render[0]=='alerta'){
$sumary='Filme Selecionado';
$detail=$_POST['moviesGrid_selection'];
if($_POST['source']=='comprar'){
$sumary='Item Comprado!';
$detail='';
}
$resposta='
<span id="alerta" class="ui-growl-pl" data-widget="widget_alerta" data-summary="data-summary" data-detail="data-detail" data-severity="all,error" data-redisplay="true"></span>
<script id="alerta_s" type="text/javascript">
DinarteCoelho.cw("Growl", "widget_alerta", {
id: "alerta",
sticky: false,
life: 6000,
escape: true,
keepAlive: false,
msgs: [{
summary: "'.$sumary.'",
detail: "'.$detail.'",
severity: "info",
severityText: "Information"
}]
});
</script>
';
}
if($render[0]=='productDetail' or $render[0]=='basicDTPnl'){
if($_POST['source']!='basicDTPnl'){
$_SESSION['codproduto']=$_POST['source'];
}
$result = "SELECT * FROM produtos p INNER JOIN categorias c ON p.categoria=c.id_categoria INNER JOIN estoque e ON p.estoque=e.id_estoque WHERE id_produto='".$_SESSION['codproduto']."'";
$result = $pdo->query($result);
$linha = $result->fetch(PDO::FETCH_ASSOC);
$avaliacao='';
for ($i = 1; $i <= 5; $i++) { $avaliacao.='<div class="ui-rating-star'; if($i<$linha['avaliacoes']){ $avaliacao.= ' ui-rating-star-on';} $avaliacao.='"><a></a></div>'; }
$resposta='
<div id="productDetail" class="ui-outputpanel ui-widget" style="text-align:center;">
<div class="product">
<div class="product-grid-item p-p-3 border-0">
<div class="product-grid-item-top">
<div>
<i class="pi pi-tag product-category-icon"></i>
<span class="product-category">'.$linha['categoria'].'</span>
</div>
<span class="product-badge status-instock">'.$linha['estoque'].'</span>
</div>
<div class="product-grid-item-content"><img src="/sistema/resource/demo/images/product/'.$linha['foto'].'.jpg" alt="" />
<div class="product-name">'.$linha['produto'].'</div>
<div class="product-description">Descrição do Produto</div>
<div id="avaliacao:'.$linha['id_produto'].'" class="ui-rating">
'.$avaliacao.'
<div class="ui-rating-star"><a></a></div><input id="avaliacao:'.$linha['id_produto'].'_input" name="avaliacao:'.$linha['id_produto'].'_input" type="hidden" autocomplete="off" aria-hidden="true" value="'.$linha['avaliacoes'].'" />
</div>
<script id="avaliacao:'.$linha['id_produto'].'_s" type="text/javascript">DinarteCoelho.cw("Rating","widget_avaliacao:'.$linha['id_produto'].'",{id:"avaliacao:'.$linha['id_produto'].'",readonly:true});</script>
</div>
<div class="product-grid-item-bottom"><span class="product-price">R$'.$linha['preco'].'</span>
<button id="comprar" name="comprar" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left" onclick="DinarteCoelho.ab({s:"comprar",f:"formulario",u:"alerta"});return false;" type="submit"><span class="ui-button-icon-left ui-icon ui-c pi pi-shopping-cart"></span><span class="ui-button-text ui-c">Adicionar ao Carrinho</span></button><script id="comprar_s" type="text/javascript">DinarteCoelho.cw("CommandButton","widget_comprar",{id:"comprar"});</script>
</div>
</div>
</div>
</div>
';
}
dc.cw("CommandButton", "widget_basic", {
id: "basic"
});
dc.cw("OverlayPanel", "widget_basicPnl", {
id: "basicPnl"
, target: "basic"
});
dc.cw("CommandButton", "widget_images", {
id: "images"
});
dc.cw("ImageSwitch", "widget_imagens", {
id: "imagens"
, fx: "fade"
, speed: 500
, timeout: 3000
});
dc.cw("OverlayPanel", "widget_imagePnl", {
id: "imagePnl"
, target: "images"
, dismissable: false
, showCloseIcon: true
});
dc.cw("Growl", "widget_alerta", {
id: "alerta"
, sticky: false
, life: 6000
, escape: true
, keepAlive: false
, alerta: []
});
dc.cw("CommandButton", "widget_movieBtn", {
id: "movieBtn"
});
dc.cw("OverlayPanel", "widget_moviePicker", {
id: "moviePicker"
, target: "movieBtn"
, dynamic: true
});
<,?php
$query = "SELECT id_produto FROM produtos LIMIT 10";
$result = $pdo->,query($query);
while ($linha = $result->,fetch(PDO::FETCH_ASSOC)){
?>,
dc.cw("CommandButton", "widget_basicDTBtn_<,?php echo $linha['id_produto']?>,", {
id: "basicDTBtn:<,?php echo $linha['id_produto']?>,"
});
<,?php
}
?>,
dc.cw("DataTable", "widget_basicDT", {
id: "basicDT"
, groupColumnIndexes: []
, disableContextMenuIfEmpty: false
});
dc.cw("OverlayPanel", "productOP", {
id: "basicDTPnl"
, dynamic: true
, dismissable: false
, showCloseIcon: true
});