Welcome Guest, Not a member yet? Register   Sign In
DMZ: HTML Table extension (contributed). DMZ 1.7+
#1

[eluser]Oblique[/eluser]
(Now with _iterated support)

ATTENTION: this extension is third-party, so don't bother Phill with questions about it.

Features are:

- well documented

- label from $validation / custom label
- mapping by $validation[‘field’][‘values’] / custom array mapping
- custom callback-generated fields

- autopagination with native CI paginator when _paged

- table elements attributes assigned automaticaly

This extension works in the similar way as original HTML Form extension.

All it does is provide render_table() method that builds html code based on settings given by user. It can save some time for you and make table-generation part of the view more readable. Extension is shipped with two table templates: object_per_row and object_per_column.

Docs are included in Distrib.

Installation: To make HTML Table available, copy application folder’s content from distrib into your application folder.

WARNING!
If you have your own MY_html_helper, be careful not to rewrite it with same file from this distrib, just append your own with it’s content.

MY_html_helper contains one single function wrap() that makes output of optional parts of page more convinient. It’s used in table templates.
#2

[eluser]Eason[/eluser]
Gosh! I just finished a DMZ extension based on nearly the same idea. I named my extension as htmllist.
#3

[eluser]Oblique[/eluser]
Yeah. Actually it was very strange that noone had posted such an obvious ext for so long time.
Now i'm finishing docs for an upgraded version.

May i look at yours? )) Maybe we can work together or smth )
#4

[eluser]Daniel H[/eluser]
Nice extension! Thanks!

I'm having some problems with toString and getting it to return the name of the relationship.

Accounts and Groups have a field called "name", so in my models I have this:

Code:
public function __toString()
    {
        return $this->name;
    }

However when executed, this error is returned

Code:
Message: Method Group::__toString() must return a string value

Same with Account.

And I am making sure I am included the related accounts and groups

Code:
$users->include_related('group', array('name'));
        $users->include_related('account', array('name'));

Any ideas?
#5

[eluser]Oblique[/eluser]
By executed do you mean you call ->render_table() ?

Please post here code snippet causing error.
#6

[eluser]Daniel H[/eluser]
This is the code.

Code:
$users = new User();
        $users->include_related('group', array('name'));
        $users->include_related('account', array('name'));
        $users->get_paged_iterated($offset, 20, TRUE);
        
        $scheme = array
        (
                'name',
                'email',
                'group',
                'account',
                'func_delete_link' => 'Delete',
                'func_edit_link' => 'Edit'
        );
        
        $opts['caption'] = 'Users';
        $opts['pagin_conf']['base_url'] = site_url('users/all/');
        
        $view_data['table'] = $users->render_table($scheme, $opts);
#7

[eluser]Oblique[/eluser]
Looks like you include related fields without instantiation, (read include_related docs) so when render_table() tries to access
$users->group group has no "name" property and it's set to null or smth.

So your $scheme should containt something like
...
'group_name' => 'Group'
'account_name' => 'Account'
...
#8

[eluser]Daniel H[/eluser]
Ah I see! I'll try that - thanks.
#9

[eluser]tranc huc[/eluser]
thanks for share
#10

[eluser]Oblique[/eluser]
Thanks for response ) Really nice to hear




Theme © iAndrew 2016 - Forum software by © MyBB