Hello..!
Im working with clientside databinding, When I try to hide some RadGrid columns this works fine, but the paging stop working..!
I need to show my columns again (this is the only way i could solve my problem) but showing|hiding my columns again (every page change) is heavy and the performance is affected. Here some code:
This is my grid..!! with only one column
Please help me, ..!! :(
Im working with clientside databinding, When I try to hide some RadGrid columns this works fine, but the paging stop working..!
I need to show my columns again (this is the only way i could solve my problem) but showing|hiding my columns again (every page change) is heavy and the performance is affected. Here some code:
This is my grid..!! with only one column
<
telerik:RadGrid
ID
=
"gdvOrdenes"
Width
=
"100%"
PageSize
=
"20"
AllowPaging
=
"True"
runat
=
"server"
EnableViewState
=
"false"
>
<
MasterTableView
AutoGenerateColumns
=
"false"
AllowFilteringByColumn
=
"True"
ShowFooter
=
"True"
<Columns>
<%--Grupo del permiso--%>
<
telerik:GridBoundColumn
DataField
=
"GrupoPermiso"
HeaderText
=
"Grupo permiso"
ShowFilterIcon
=
"false"
Resizable
=
"False"
SortExpression
=
"GrupoPermiso"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"StartsWith"
UniqueName
=
"PermissionGroup"
/>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
EnableRowHoverStyle
=
"false"
>
<
Scrolling
AllowScroll
=
"false"
/>
<
ClientEvents
OnCommand
=
"Solicitudes_Command"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
This function is executed at the begining
function
PreparaVistaRadGrid(lista)
{
try
{
var
listaColumnasBloqueadas = lista[0].ListaColumnaBloqueadas.split(
'|'
);
var
cantidad = tableView.get_columns().length;
//Muestra todas las columnas, Show all columns
for
(
var
x = 0 ; x < cantidad ; x++ )
tableView.showColumn(x);
//Oculta columnas, Hide some columns
var
columnas = tableView.get_columns();
for
(
var
x = 0 ; x < columnas.length ; x++ )
if
($.inArray(columnas[x]._data.UniqueName, listaColumnasBloqueadas) >= 0)
tableView.hideColumn(x);
}
catch
(ex)
{
AtraparError(
"PoolAgente.aspx"
, arguments, ex);
}
}
//This is the function for the Paging, Filtering and Sorting
function
Solicitudes_Command(sender, args)
{
try
{
args.set_cancel(
true
);
commandName = args.get_commandName();
PageMethods.EjecutaConsulta(tableView.get_currentPageIndex() * tableView.get_pageSize(), tableView.get_pageSize(), tableView.get_sortExpressions().toString(),
tableView.get_filterExpressions().toDynamicLinq(), _tipoAccionSeleccionada,
false
, RealizoAccion);
}
catch
(ex)
{
$find(_nombreRadAjaxLoadingOperations).hide(_nombreGdvOrdenes);
}
}
Here is where im obligated to hide and show my columns againfunction
RealizoAccion(result)
{
try
{
//Oculta ventana de loading
$find(_nombreRadAjaxLoadingOperations).hide(_nombreGdvOrdenes);
tableView.set_dataSource(result.resultado);
tableView.dataBind();
//HERE IM OBLIGATED TO HIDE/SHOW
IN ORDER TO THE "PAGING" WORKS
//PreparaVistaRadGrid
()
if
(commandName ==
"Filter"
|| commandName ==
"Load"
|| commandName ==
"Page"
)
PageMethods.GetCount(updateVirtualItemCount);
}
catch
(ex) {
AtraparError(
'Valida Inicio'
, arguments, ex);
}
}
function
updateVirtualItemCount(result)
{
try
{
//Se visualiza el número de documentos encontrados
if
(commandName ==
"Load"
)
{
tableView.set_currentPageIndex(0,
true
);
}
tableView.set_virtualItemCount(result);
}
catch
(ex)
{ AtraparError(
"PoolAgente.aspx"
, arguments, ex);
}
}
Please help me, ..!! :(