View Full Version : [CLOSED] Conditional Hide GridPanel ComponentColumn

Aug 20, 2014, 11:05 AM
Mine is ASP.net MVC razer view engine application.

I want to hide ComponentColumn as per value of column of respective row index.


Aug 20, 2014, 12:41 PM
Hi @PriceRightHTML5team,

So, have you tried anything?

Ideally, if you can determine a ComponentColumn should be hidden before the time of rendering of GridPanel, it would be best just to set a ComponentColumn's Hidden property to true.

Aug 20, 2014, 1:30 PM
Yes I have tried.

Grid Model fileds

,new ModelField("PackPayerSubSegmentId", ModelFieldType.Int)
,new ModelField("PayerSegment", ModelFieldType.String)
,new ModelField("PackPayerSubSegmentId", ModelFieldType.String)
,new ModelField("ClassificationType", ModelFieldType.String)
,new ModelField("Channel", ModelFieldType.String)
,new ModelField("AdjustmentType", ModelFieldType.String)
,new ModelField("Weight", ModelFieldType.String)


Html.X().ComponentColumn().Text("Channel Weight %").DataIndex("Weight")
Html.X().ComponentColumn().Text("Max Discount %").DataIndex("NewMaxDiscountPercent")
Html.X().ComponentColumn().Text("Max Fees** %").DataIndex("NewMaxFeesUSD")
Html.X().ComponentColumn().Text("AVG Deduction %").DataIndex("NewAvgDeductionPercent")

With reference to above code,
I want to hide Weight Component of ComponentColumn Channel Weight on the basis of PackPayerSubSegmentId model filed value.

For your reference i have written Component property .Hidden true. But i want to set it as per model field value.

I have tried rendere;

var visiblity = function (value, meta, record, index)
if (record.data.PackPayerSubSegmentId == "") {
return '';

else {
var text = meta.column;

Aug 21, 2014, 9:30 AM
It looks you need to use a ComponentColumn's BeforeBind listener. If return false from that, a ComponentColumn doesn't render its Component. A BeforeBind fires for each row and a record is being passed as argument.

Aug 21, 2014, 9:34 AM
Thanks Danill,

We had also resolved this by :

.Component(Html.X().TextField()).Listeners(li=>li.BeforeBind.Handler="if(e.record.get('PackPayerSubSegmentId') != '') {e.config[0].hidden = true}")