Paginacion Manual en genexus

6
Event Start .... &CurrentPage.Visible = 0 &TotalPages.Visible = 0 EndEvent /----------------------------------------------------------------- ------------------------ Event Gridxx.Load For each &TotReg +=1 &TotalPages = Round( (&TotReg / Grid1.Rows) + 0.5 , 0) LOAD EndFor EndEvent /----------------------------------------------------------------- ------------------------ Event First.Click Grid1.FirstPage() &CurrentPage = 1 EndEvent /----------------------------------------------------------------- ------------------------ Event Previous.Click

description

Paginacion Manual en genexus

Transcript of Paginacion Manual en genexus

Event Start .... &CurrentPage.Visible = 0 &TotalPages.Visible = 0 EndEvent /-----------------------------------------------------------------------------------------Event Gridxx.Load For each &TotReg +=1 &TotalPages = Round( (&TotReg / Grid1.Rows) + 0.5 , 0) LOAD EndFor EndEvent /-----------------------------------------------------------------------------------------

Event First.Click Grid1.FirstPage() &CurrentPage = 1 EndEvent /-----------------------------------------------------------------------------------------

Event Previous.Click Grid1.PreviousPage() &CurrentPage -= 1 if &CurrentPage < 1 &CurrentPage = 1 endif EndEvent /-----------------------------------------------------------------------------------------

Event Next.Click Grid1.NextPage() &CurrentPage += 1 if &CurrentPage > &TotalPages &CurrentPage = &TotalPages endif EndEvent /-----------------------------------------------------------------------------------------Event Last.Click do while &CurrentPage < &TotalPages Grid1.NextPage() &CurrentPage += 1 enddo EndEvent /-----------------------------------------------------------------------------------------No te olvides de alojar las variables &CurrentPage y &TotalPages en el webform. Especialmente la variable &TotalPages , alojala "debajo" del grid.

----Event Start ----//manejo de las paginas del grid -----Grid1.Rows = 7//Indico la cantidad de registros por pagina -----&CurrentPage = 1//Indico la pagina por defecto -----&i.Visible = 0 -----EndEvent // Start

Event Grid1.Load //En el load del Grid cargo las variables y cuento la cantidad de registros for each &Var1 = Att1 &Var2 = Att2 &i += 1 //Cuento los Registros &PageCount = (&i / 7) + 1 //Calculo la cantidad de paginas segn las que muestro en cada pagina Load endfor Do 'FixCurrentPage' EndEvent // Load

Sub 'FixCurrentPage' If &i = 0 // &CurrentPage = 0 TextBlockPrevio.Visible = 0 TextBlockSiguiente.Visible = 0 &CurrentPage.Visible = 0 &PageCount.Visible = 0 TextBlockde.Visible = 0 TextBlockSinRegistros.Visible = 1 Else &CurrentPage.Visible = 1 &PageCount.Visible = 1 TextBlockde.Visible = 1 TextBlockSinRegistros.Visible = 0 If &CurrentPage > &PageCount &CurrentPage = &PageCount Else If &CurrentPage < 1 &CurrentPage = 1 EndIf EndIf if &CurrentPage = (&i / 7) + 1 TextBlockPrevio.Visible = 1 TextBlockSiguiente.Visible = 0 endif if &CurrentPage = 1 TextBlockPrevio.Visible = 0 if &PageCount = 1 TextBlockSiguiente.Visible = 0 endif endif if &CurrentPage > 1 TextBlockPrevio.Visible = 1 endif EndIf EndSub

Event TextBlockPrevio.Click &CurrentPage = &CurrentPage - 1 Grid1.PreviousPage() EndEvent // Event TextBlockSiguiente.Click &CurrentPage = &CurrentPage + 1 Grid1.NextPage() Endevent