Laravel-datatables: how i can change the header title ?

Created on 26 Nov 2015  Â·  9Comments  Â·  Source: yajra/laravel-datatables

how i can change the header title ?

i use the Datatables as service and i try the edit column but its affect the result of that column not the title of it

for example the id column i need to make it as # also from my database i have some spelling mistake so i was think it will be easy if there is way to edit the column name from the table it self rather than playing with db again =(

Most helpful comment

on the html builder you want the 'title' attribute.

public function html()
    {
        return $this->builder()
            ->columns([
                [
                    "name" => "contractvalue",
                    "title" => "Contract Value",
                    "data" => "contractvalue"
                ],

All 9 comments

on the html builder you want the 'title' attribute.

public function html()
    {
        return $this->builder()
            ->columns([
                [
                    "name" => "contractvalue",
                    "title" => "Contract Value",
                    "data" => "contractvalue"
                ],

@Skintillion i try this before but it give me this error

image


update:

thanks its work now i think there was some missing lines i didnt add to end >_<

thanks again

Guys FYI: https://github.com/yajra/laravel-datatables/issues/265 Major breaking change is coming next week.

public function html()
{
return $this->builder()
->columns($this->getColumns())
->minifiedAjax()
->addAction(['width' => '120px', 'printable' => false])
->parameters([
'dom' => 'Bfrtip',
'stateSave' => true,
'order' => [[0, 'desc']],
'buttons' => [
['extend' => 'export', 'className' => 'btn btn-default btn-sm no-corner',],
['extend' => 'print', 'className' => 'btn btn-default btn-sm no-corner',],
['extend' => 'reload', 'className' => 'btn btn-default btn-sm no-corner',],
],
]);
}

protected function getColumns()
{
return [
'id',
'name',
'section',
'contact',
'approved',
'cardno',
'issuedate',
'status' => 'Approval Status'
];
}

I got the above DataTables warning

@Fionajeremychik Use an array to set the attributes.

```php
['data' => 'status', 'title' => 'Approval Status']
````

Thanks. I got it.

  1. How to add placeholder inside the Search
  2. How to use export .csv or excel, how to add header title inside excel and how to print
    public function html()
    {
    return $this->builder()
    ->columns($this->getColumns())
    ->minifiedAjax()
    ->addAction(['width' => '120px', 'printable' => false])
    ->parameters([
    'dom' => 'Bfrtip',
    'stateSave' => true,
    'order' => [[0, 'desc']],
    'buttons' => [
    ['extend' => 'export', 'className' => 'btn btn-default btn-sm no-corner',],
    ['extend' => 'print', 'className' => 'btn btn-default btn-sm no-corner',],
    ['extend' => 'reload', 'className' => 'btn btn-default btn-sm no-corner',],
    ],
    ]);
    }

Hi Arjay,

Thank for your help.

[image: Screenshot 2020-07-07 at 9.08.52 PM.png]

  1. How to add placeholder inside the Search field
  2. How to add header title inside Excel
    How to disable to export pdf
    How to print

On Mon, 6 Jul 2020 at 12:04, Arjay Angeles notifications@github.com wrote:

@Fionajeremychik https://github.com/Fionajeremychik Use an array to set
the attributes.

['data' => 'status', 'title' => 'Approval Status']

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/yajra/laravel-datatables/issues/264#issuecomment-653977842,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAFHM4BRZSOBMFR5WLHO4GTR2EWJNANCNFSM4BVG3YIA
.

Try to read the documentation a bit. You can't rely on us to answer every
basic question without trying yourself.

On Tue, Jul 7, 2020, 4:16 AM Fionajeremychik, notifications@github.com
wrote:

Hi Arjay,

Thank for your help.

[image: Screenshot 2020-07-07 at 9.08.52 PM.png]

  1. How to add placeholder inside the Search field
  2. How to add header title inside Excel
    How to disable to export pdf
    How to print

On Mon, 6 Jul 2020 at 12:04, Arjay Angeles notifications@github.com
wrote:

@Fionajeremychik https://github.com/Fionajeremychik Use an array to
set
the attributes.

['data' => 'status', 'title' => 'Approval Status']

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
https://github.com/yajra/laravel-datatables/issues/264#issuecomment-653977842
,
or unsubscribe
<
https://github.com/notifications/unsubscribe-auth/AAFHM4BRZSOBMFR5WLHO4GTR2EWJNANCNFSM4BVG3YIA

.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/yajra/laravel-datatables/issues/264#issuecomment-654783072,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AALTOYQNV6VPAPWQEBP2AHDR2L7X5ANCNFSM4BVG3YIA
.

Hi Arjay,

Can you tell me where I can find the document? Thanks

On Wed, 8 Jul 2020 at 01:56, Skintillion notifications@github.com wrote:

Try to read the documentation a bit. You can't rely on us to answer every
basic question without trying yourself.

On Tue, Jul 7, 2020, 4:16 AM Fionajeremychik, notifications@github.com
wrote:

Hi Arjay,

Thank for your help.

[image: Screenshot 2020-07-07 at 9.08.52 PM.png]

  1. How to add placeholder inside the Search field
  2. How to add header title inside Excel
    How to disable to export pdf
    How to print

On Mon, 6 Jul 2020 at 12:04, Arjay Angeles notifications@github.com
wrote:

@Fionajeremychik https://github.com/Fionajeremychik Use an array to
set
the attributes.

['data' => 'status', 'title' => 'Approval Status']

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<

https://github.com/yajra/laravel-datatables/issues/264#issuecomment-653977842

,
or unsubscribe
<

https://github.com/notifications/unsubscribe-auth/AAFHM4BRZSOBMFR5WLHO4GTR2EWJNANCNFSM4BVG3YIA
>

.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
https://github.com/yajra/laravel-datatables/issues/264#issuecomment-654783072
,
or unsubscribe
<
https://github.com/notifications/unsubscribe-auth/AALTOYQNV6VPAPWQEBP2AHDR2L7X5ANCNFSM4BVG3YIA

.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/yajra/laravel-datatables/issues/264#issuecomment-654959561,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAFHM4BP7MOY2A44FLS4JFDR2NATHANCNFSM4BVG3YIA
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hari-web picture hari-web  Â·  3Comments

sangnguyenplus picture sangnguyenplus  Â·  3Comments

macnux picture macnux  Â·  3Comments

SGarridoDev picture SGarridoDev  Â·  3Comments

josiahke picture josiahke  Â·  3Comments