F
Filament12mo ago
Abi

`openUrlInNewTab` with `url` method on a TextColumn doesn't seem to open url in a new tab

I have the following code for my table
TextColumn::make('payment_intent_id')
->searchable()
->label('Payment Link ID')
->icon('ri-external-link-fill')
->openUrlInNewTab()
->formatStateUsing(function ($record) {
if ($record->payment_method === 'STRIPE') {
return 'Stripe URL';
}

return 'Braintree URL';
})
->url(function ($record) {
if ($record->payment_method === 'STRIPE') {
return 'https://dashboard.stripe.com/payments/'.$record->payment_intent_id;
}

return 'https://www.braintreegateway.com/merchants/transactions/'.$record->payment_intent_id;
})
TextColumn::make('payment_intent_id')
->searchable()
->label('Payment Link ID')
->icon('ri-external-link-fill')
->openUrlInNewTab()
->formatStateUsing(function ($record) {
if ($record->payment_method === 'STRIPE') {
return 'Stripe URL';
}

return 'Braintree URL';
})
->url(function ($record) {
if ($record->payment_method === 'STRIPE') {
return 'https://dashboard.stripe.com/payments/'.$record->payment_intent_id;
}

return 'https://www.braintreegateway.com/merchants/transactions/'.$record->payment_intent_id;
})
am I missing something that restricts it. Right now, the link button that shows on the table, refreshes the page and then redirects to the url on the same tab instead of a new tab
Solution:
You must add
->openUrlInNewTab()
->openUrlInNewTab()
after
->url()
->url()
like following: ```php ->url(fn ($record) => 'https://dashboard.stripe.com/payments/')...
Jump to solution
2 Replies
Solution
KA
KA12mo ago
You must add
->openUrlInNewTab()
->openUrlInNewTab()
after
->url()
->url()
like following:
->url(fn ($record) => 'https://dashboard.stripe.com/payments/')
->openUrlInNewTab()
->url(fn ($record) => 'https://dashboard.stripe.com/payments/')
->openUrlInNewTab()
Abi
AbiOP12mo ago
ok, let me try that. i didn't know the order of the call was important thank you that worked. appreciate the help
Want results from more Discord servers?
Add your server