Scritik / prestui

UI library for PrestaShop modules
MIT License
44 stars 14 forks source link

Fails when using ps-table tag #16

Closed roja45 closed 6 years ago

roja45 commented 7 years ago

Creating a ps-table using your example array, all other tags I've used so far have worked perfectly, I just can't this ps-table tag to load, am I missing something?

Thanks

'data' => Tools::jsonEncode(array(
                    'columns' => array(
                        array('content' => 'ID', 'key' => 'id', 'center' => true),
                        array('content' => 'Email', 'key' => 'email'),
                        array('content' => 'Name', 'key' => 'name'),
                        array('content' => 'Active', 'key' => 'active', 'bool' => true, 'center' => true, 'fa' => true)
                    ),
                    'rows' => array(
                        array('id' => 1, 'email' => 'bob@google.com', 'name' => 'Bob'),
                        array('id' => 2, 'email' => 'john@google.com', 'name' => 'John')
                    ),
                    'rows_actions' => array(
                        array('title' => 'Edit', 'action' => 'edit_employee', 'icon' => 'pencil', 'img' => '../img/admin/edit.gif', 'fa' => 'pencil'),
                        array('title' => 'Delete', 'action' => 'delete_employee', 'icon' => 'trash', 'img' => '../img/admin/delete.gif', 'fa' => 'trash')
                    ),
                    'top_actions' => array(
                        array('title' => 'Add employee', 'action' => 'add_employee', 'icon' => 'add', 'img' => 'themes/default/img/process-icon-new.png', 'fa' => 'plus'),
                    ),
                    'url_params' => array('configure' => 'A Name'),
                    'identifier' => 'id'
                ))

Resulting template code is: <ps-table header="Models" icon="icon-users" content="{"columns":[{"content":"ID","key":"id","center":true},{"content":"Email","key":"email"},{"content":"Name","key":"name"},{"content":"Active","key":"active","bool":true,"center":true,"fa":true}],"rows":[{"id":1,"email":"bob@google.com","name":"Bob"},{"id":2,"email":"john@google.com","name":"John"}],"rows_actions":[{"title":"Edit","action":"edit_employee","icon":"pencil","img":"..\/img\/admin\/edit.gif","fa":"pencil"},{"title":"Delete","action":"delete_employee","icon":"trash","img":"..\/img\/admin\/delete.gif","fa":"trash"}],"top_actions":[{"title":"Add employee","action":"add_employee","icon":"add","img":"themes\/default\/img\/process-icon-new.png","fa":"plus"}],"url_params":{"configure":"A Name"},"identifier":"id"}" no-items-text="No items found"></ps-table>

which seems ok, but I get an error: VM10986:1 Uncaught SyntaxError: Unexpected token c in JSON at position 0 at JSON.parse (<anonymous>) at re.<anonymous> (<anonymous>:6:17) at re.<anonymous> (riot+compiler.min.js:2) at re.M (riot+compiler.min.js:2) at O (riot+compiler.min.js:2) at re.k (riot+compiler.min.js:2) at re.<anonymous> (riot+compiler.min.js:2) at re.<anonymous> (riot+compiler.min.js:2) at re.M (riot+compiler.min.js:2) at O (riot+compiler.min.js:2)

Scritik commented 7 years ago

I updated the wiki, can you try again?