⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠


Sorin Sfirlogea

Member Since 03 Dec 2020
Offline Last Active Apr 03 2021 12:48 PM
-----

Posts I've Made

In Topic: setRelation relational table field column display

18 January 2021 - 03:25 PM

Not 100% sure, but I don't think that this is the purpose of setRelation function. It seems to be designed only to replace foreign keys with a proper name from the related table, but the other fields are not available as columns in the datagrid. The only workaround that I see is to use the multiple fields option from setRelation function. Instead of returning one field, it can concatenate several fields and display them, but in the same column of the related foreign key

Example: 
Table CUSTOMER with fields: id, name, city_id 
Table CITY with fields: id, name, country
 
$crud->setTable('CUSTOMER'); 
$crud->setRelation('city_id', 'CITY', 'name'); 

will result in 
--------------------------------- 
| id | name       | city_id     | 
--------------------------------- 
| 1  | John Smith | Madrid      | 

and: 
$crud->setTable('CUSTOMER'); 
$crud->setRelation('city_id', 'CITY', '{name}, {country}'); 

will result in 
----------------------------------- 
| id | name       | city_id       | 
----------------------------------- 
| 1  | John Smith | Madrid, Spain |

Hope that helps.


In Topic: callbackColumns $row error: Undefined index

06 January 2021 - 02:16 PM

Apparently this bug reappeared in version 2.8.7.

$crud->columns( ['document_number', 'document_date', 'partner_id', 'product_id', 'quantity', 'amount', 'special_location'] );

$crud->callbackColumn( 'amount', function( $value, $row) {
  return $value . ' ' . getCurrencyCodeByID( $row->currency_id );
});

If I don't include currency_id field in the displayed columns, I get an undefined index error.

Could you please take a look into it?


In Topic: Dropdown values are hidden under table footer

03 December 2020 - 09:33 PM

Gotcha! Solved it.

In grocery-crud-v2.8.6.2ede690.css some adjustments must be done:

 

.gc-modal-body {
  overflow: auto visible;
}

 

.gc-datagrid-table-container {
  overflow-x: auto visible;
  padding: 0px 10px;
}