This question is locked. New answers and comments are not allowed.
i want to know how many columns has been hidden for next load same view with grid.
i can use the ColumnContextMenu method to visible or hide a column, but how can i get all columns has been hidden?
i want to use client event ,but i can not find. which event can be use for me ?
whether has other way to solve my problem?
i can use the ColumnContextMenu method to visible or hide a column, but how can i get all columns has been hidden?
i want to use client event ,but i can not find. which event can be use for me ?
whether has other way to solve my problem?
6 Answers, 1 is accepted
0
Dadv
Top achievements
Rank 1
answered on 22 Feb 2012, 03:27 PM
Hi,
You could use this in javascript to add the fields names to the query :
I didn't test it but i think something like this will work.
Regards,
You could use this in javascript to add the fields names to the query :
<script type="text/javascript">
function Grid_onDataBinding(e) {
var hiddens= ''; $('.t-header:hidden').each(function (index) { hiddens += $(this).text() + ',' }); // pass additional values by setting the "data" field of the event argument
e.data = {
hiddens: hiddens
};
}
</script>
I didn't test it but i think something like this will work.
Regards,
0
Zhaoning
Top achievements
Rank 1
answered on 23 Feb 2012, 03:31 AM
thks Dadv!
but i can't get anything.
the grid is telerik UI Component for ASP.NET MVC.
the source code of web page is :
jQuery(document).ready(function(){
jQuery('#Menu').tMenu();
jQuery('#ELISAAssay').tGrid({columns:[{"title":"Name","member":"Name","type":"String"},{"title":"Instrument Assay Name","member":"InstrumentAssayName","type":"String"},{"title":"Kit Lot","member":"KitGUID","type":"Object"},{"title":"Revision Number","member":"RevisionNumber","type":"Number"},{"title":"Created By","member":"CreatedBy","type":"Object"},{"title":"Description","member":"Discription","type":"String"},{"title":"Action Link"}], plugins:["filtering","resizing","reordering"], urlFormat:'/AusLIMS.Web/Assay/ELISAQualitative?ELISAAssay-page=%7B0%7D&ELISAAssay-orderBy=%7B1%7D&ELISAAssay-filter=%7B3%7D', total:0, currentPage:1, pageSizesInDropDown:["5","10","20","50"], pageOnScroll:false, sortMode:'single', columnContextMenu:true,
but i can't get anything.
the grid is telerik UI Component for ASP.NET MVC.
the source code of web page is :
jQuery(document).ready(function(){
jQuery('#Menu').tMenu();
jQuery('#ELISAAssay').tGrid({columns:[{"title":"Name","member":"Name","type":"String"},{"title":"Instrument Assay Name","member":"InstrumentAssayName","type":"String"},{"title":"Kit Lot","member":"KitGUID","type":"Object"},{"title":"Revision Number","member":"RevisionNumber","type":"Number"},{"title":"Created By","member":"CreatedBy","type":"Object"},{"title":"Description","member":"Discription","type":"String"},{"title":"Action Link"}], plugins:["filtering","resizing","reordering"], urlFormat:'/AusLIMS.Web/Assay/ELISAQualitative?ELISAAssay-page=%7B0%7D&ELISAAssay-orderBy=%7B1%7D&ELISAAssay-filter=%7B3%7D', total:0, currentPage:1, pageSizesInDropDown:["5","10","20","50"], pageOnScroll:false, sortMode:'single', columnContextMenu:true,
0
Hello Zhaoning,
There isn't event to indicate that particular column is hidden/shown. However in the moment you need to get which columns are hidden you do so by using the following code.
Regards,
Nikolay Rusev
the Telerik team
There isn't event to indicate that particular column is hidden/shown. However in the moment you need to get which columns are hidden you do so by using the following code.
var grid = $("#ELISAAssay").data("tGrid");var hidden = $.grep(grid.columns, function(column) { return column.hidden });//and if you need the fields to which the column is bound tohidden = $.map(hidden, function(column) { return column.member });Regards,
Nikolay Rusev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Zhaoning
Top achievements
Rank 1
answered on 29 Feb 2012, 03:54 AM
thks Nikolay Rusev, i have get them !
why no event could be used after options window show or hide column hide ?
why no event could be used after options window show or hide column hide ?
0
Hello Zhaoning,
Until now there was no requests for such event and this is the reason for not having it. We will think about introducing such event i future versions of the Grid. For the moment you can use the suggested implementation.
All the best,
Nikolay Rusev
the Telerik team
Until now there was no requests for such event and this is the reason for not having it. We will think about introducing such event i future versions of the Grid. For the moment you can use the suggested implementation.
All the best,
Nikolay Rusev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Rajeev
Top achievements
Rank 1
answered on 20 Jul 2012, 06:26 PM
Hi Nikolay Rusev ,
I want to hide grid column on client. I am using this code in java script.
$('#CheckboxID').click(function () {
var grid = $("").data('tGrid');
if ($(this).is(':checked')) {
// the checkbox was checked
grid.showColumn("ColumnName");
} else {
// the checkbox was unchecked
grid.hideColumn("ColumnName");
}
});
But I got this error.
Microsoft JScript runtime error: Object doesn't support property or method 'showColumn'
Thanks
RK
I want to hide grid column on client. I am using this code in java script.
$('#CheckboxID').click(function () {
var grid = $("").data('tGrid');
if ($(this).is(':checked')) {
// the checkbox was checked
grid.showColumn("ColumnName");
} else {
// the checkbox was unchecked
grid.hideColumn("ColumnName");
}
});
But I got this error.
Microsoft JScript runtime error: Object doesn't support property or method 'showColumn'
Thanks
RK