how to solve?
//CRIA A GIRD PERSONALIZADA
myapp.CadastraPedido.TBLCDSCLI0_render = function ( element, contentItem )
{
var itemTemplate = $( "<div></div>" ).attr( 'id', 'TBLCDSCLI0' )
itemTemplate.appendTo( $( element ) );
contentItem.value.oncollectionchange = function ()
{
var database = contentItem.valueModel.source.target.source.member.id.split( "/" )[0]
var table = contentItem.valueModel.name
var vCollection = myapp.rootUri + "/" + database + ".svc/" + contentItem.valueModel.name;
if ( itemTemplate.hasClass( 'e-grid' ) )
{
itemTemplate.ejGrid( 'destroy' );
}
var first = contentItem.children[0], fieldname = [];
for ( i = 0; i < first.children.length; i++ )
{
fieldname[i] = { field: first.children[i].valueModel.name };
}
//Rendering the Grid Control
itemTemplate.ejGrid(
{
dataSource: ej.DataManager( { url: vCollection } ),
allowScrolling: true,
scrollSettings: { width: 0, height: 400, allowVirtualScrolling: true, virtualScrollMode: ej.Grid.VirtualScrollMode.Continuous },
isResponsive: true,
enableResponsiveRow: true,
allowSelection: true,
allowFiltering: true,
enableRowHover: true,
columns: [
{ field: "Id", headerText: "Código", isPrimaryKey: true, textAlign: ej.TextAlign.Right, width: 80, priority: 1 },
{ field: "CODIGO", headerText: "Código Solution", textAlign: ej.TextAlign.Right, width: 80, priority: 1 },
{ field: "RAZAO", headerText: "Razão", textAlign: ej.TextAlign.Right, width: 120, priority: 1 },
{ field: "FANTASIA", headerText: "Fantasia", width: 120, textAlign: ej.TextAlign.Right, priority: 1 },
{ field: "CNPJ", headerText: "CNPJ", textAlign: ej.TextAlign.Right, width: 130, priority: 2 },
{ field: "CPF", headerText: "CPF", width: 120, priority: 3 },
{ field: "FONE", headerText: "Telefone", width: 110, priority: 4 }
],
rowSelected: function ( args )
{
myapp.activeDataWorkspace.PEDIDOSData.TBLCDSCLI0_SingleOrDefault( args.data.Id ).execute().then(
function ( data )
{
ReturnCli( data, contentItem.screen );
} );
contentItem.screen.closePopup( "ConsultaClientes" );
}
} );
}
}
//ABRE O POPUP DE CONSULTA DE CLIENTE
myapp.CadastraPedido.PopupCliente_execute = function ( screen )
{
$( window ).one( "popupcreate", function ( e )
{
$( e.target ).popup( {
positionTo: "window",
afteropen: function ( event, ui )
{
try
{
if ( ConsultaCliente == 1 )
{
window.setTimeout( UpdateWid, 1000 );
}
} catch ( e )
{
////// NAO FAZ NADA
}
//DEPOIS DE CARREGAR PRECISO ATUALIZAR ELE NO CENTRO DA TELA
/**/
}
} );
} );
//screen.TBLCDSCLI0.load();
if ( ConsultaCliente == 1 )
{
screen.TBLCDSCLI0.refresh();
}
screen.showPopup( "ConsultaClientes" );
$( window ).scroll( function ( e )
{
UpdateWid();
} );
}
function UpdateWid()
{
$( window ).resize();
}
function ReturnCli( data, MyScreen )
{
MyScreen.TBLCDSCLI0.selectedItem = data.results[0]
MyScreen.TBLMVMPED0Item.setTBLCDSCLI0Item( MyScreen.TBLCDSCLI0.selectedItem );
}