This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

craw
craw

Hey guys, is the an example how to use the Formwidget Plugin Datagrid ?

Flynsarmy
Flynsarmy

I asked Sam about this the other day. He hasn't started documenting widgets yet. Get on IRC and let him know you want it :)

Shahiem
Shahiem

I figured it out:

products:

    label: Products
    type: datagrid

    columns: 
     id:
      title: Item

Flynsarmy
Flynsarmy

Nice @Shaliem! Sam mentioned to me earlier today that search and pagination functionality will eventually be coming also. That'll be very helpful.

Shahiem
Shahiem

No problem Other example

title:
    label: Invoice
    span: right

status:
    label: Invoice
    span: right

products:
    label: Products
    type: datagrid

    columns: 
        item:
            title: Item 
        price:
            title: Unit price 
            type: currency
            format: s0,0.00
        qty:
            title: Quantity 
            type: numeric  
        total:
            title: Total
            type: autocomplete
            options: 
                hoi: ss
                ss: ss
                qq: qq
                ff: ff

Last updated

craw
craw

Allright I also have to set the attributes that are jsonable in my Model.

protected $jsonable = ['data'];

Last updated

daftspunky
daftspunky

Use DataTable instead, DataGrid will be removed shortly.

chris10207
chris10207

any documentation for using Datatable widget please ?

Mohsin
Mohsin

+1 documentation would be helpful.

chris10207
chris10207

just to share with you guys what i found so far, here we go to put inside your fields.yaml Note that the field name 'attributes_data' is in json format based on the column name

    attributes_data:
        label: Datas
        type: datatable
        columns:
            attribute_name:
                title: Attribute name
            attribute_value:
                title: Attribute value
                type: currency
                format: s0,0.00
            qty:
                title: Quantity
                # type: numeric
            total:
                title: Total
                type: autocomplete
                options:
                    hoi: ss
                    ss: ss
                    qq: qq
                    ff: ff
chris10207
chris10207

but be aware that the datable does not work properly when used in a relation or pivot form. the data are not saved in database in that situation

1-11 of 11

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.