Datatables 如何将Intl组件与表格生成器一起使用?
嘿,我在Symfony 4.3中使用了omis/datatables包。 我在数据库中存储来自Intl的国家代码。 使用table Builder时如何使用Datatables 如何将Intl组件与表格生成器一起使用?,datatables,symfony4,symfony-4.3,Datatables,Symfony4,Symfony 4.3,嘿,我在Symfony 4.3中使用了omis/datatables包。 我在数据库中存储来自Intl的国家代码。 使用table Builder时如何使用Intl::getRegionBundle()->getCountryName($value)。下面是我的代码(但不起作用) 这项工作我犯了错误,字段名-- $table = $this->datatableFactory->create([]) ->add('name', TextColumn::class
Intl::getRegionBundle()->getCountryName($value)
。下面是我的代码(但不起作用)
这项工作我犯了错误,字段名--
$table = $this->datatableFactory->create([])
->add('name', TextColumn::class, ['label' => 'Name', 'className' => 'bold'])
->add('adress', TextColumn::class, ['label' => 'Adress', 'className' => 'bold'])
->add('city', TextColumn::class, ['label' => 'City', 'className' => 'bold'])
->add('state', TextColumn::class, ['label' => 'State', 'className' => 'bold'])
->add('country_code', TextColumn::class, ['label' => 'Country', 'className' => 'bold', 'render' => function($value, $context) {
return Intl::getRegionBundle()->getCountryName($value);}])
->add('vat', TextColumn::class, ['label' => 'VAT', 'className' => 'bold'])
->add('regon', TextColumn::class, ['label' => 'Regon', 'className' => 'bold'])
->createAdapter(ORMAdapter::class, [
'entity' => Company::class
])
->handleRequest($request);
if ($table->isCallback()) {
return $table->getResponse();
}