yajra / laravel-datatables

jQuery DataTables API for Laravel
https://yajrabox.com/docs/laravel-datatables
MIT License
4.76k stars 858 forks source link

how i can change the header title ? #264

Closed 8lbiasian closed 8 years ago

8lbiasian commented 8 years ago

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 =(

Skintillion commented 8 years ago

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

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

@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

yajra commented 8 years ago

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

Fionajeremychik commented 4 years ago

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

yajra commented 4 years ago

@Fionajeremychik Use an array to set the attributes.

['data' => 'status', 'title' => 'Approval Status']
Fionajeremychik commented 4 years ago

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',], ], ]); }
Fionajeremychik commented 4 years ago

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 .

Skintillion commented 4 years ago

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 .

Fionajeremychik commented 4 years ago

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 .