Hide column depending a column value as filter

I have table with transactions with different currencies, pesos and USD and we would like to hide the columns that belong to pesos when the transaction is USD and viceversa. We have a column that show the currency so we can filter it.

We tried sorting like this but is not working, any ideas I will really appreciate them…

TB.render(‘component_5’, function(data) {

if(!"{field_184}".contains("USD")){

    $('.role-hide').hide();

}

});

TB.render(‘component_5’, function(data) {

if(!"{field_184}".contains("Pesos")){

    $('.usd-hide').hide();

}

});

hi, I think you can use the “Display Rule” option; go to Page Builder > Page to edit > Table component to edit > Click to open the edit menu > click in the field i.e., Exchange > Display Rule Tab > you can set a rule i.e., if “Currency” = or contains USD, hide value. for that you need to insert the currency field in the table component, but you can hide it adding the class “hide” in the edit field form

Thanks Aprada, I tried that but it doesn’t hide the column, just the value.

Yes, you are right. But it can be quite appealing to the users. Check my app photo, the buttons show or hide depending on the values of some fields to create the proper workflow. I don’t feel the columna lines are disturbing, since for each record you have different situations.

@SalBan

If you’re working with a table, the results are multiple records, so referring to field_184 is not correctly referencing anything.

If you’re looking to hide an entire column in a table, I’m assuming the values for all records will be the same. In that case, you can do something like this:

TB.render('component_5', function(data) {
   	var currency = data.records[0]['field_184'];
	if (currency.contains('Pesos')){
	       $('.usd-hide').hide();
	}
});

This will look at the value of field_184 in the first record, and hide the css class based on that.

Please let me know if you have any other quesitons with this.

Is not a Currency filed is a Multi-Select field - The “Moneda” (Filed_184) is a Multi-select field with options:

  • USD
  • Pesos
  • EUR

In a single table you have records with different values? Meaning record 1 might be USD while record 2 can be EUR?

If you can share some screenshots of what you’re trying to do, that would be helpful in guiding you.

Yes exactly…

I understand. So in the first row since its USD you want to hide all the Pesos columns. But, if you hide those columns, the rows that are Pesos will also get hidden.

Hiding a column will apply to the whole table, not just the cell. If you want to hide the cell you can just use the display rules in a table.

Hi, if you give a try to my previous suggestion (Display Rules) and you apply the Atlas Theme to the app, the result may be as the expected, check the app photo below and how the buttons and columns are not visible.