You could help me with one last thing if you don’t mind!
I’m trying to add this custom column:
->add_column(‘created_date’, ‘date(‘d-m-Y’,$1)’, ‘users.created_on’)
But obviously it isn’t working. How can i include that $1 in the date function? Any ideas?
i’m making a callback function for this. some examples:
->add_column('created_date', '$1', 'callback_date(d-m-Y|created_on)')
->add_column('time', '$1', 'callback_date(M-d-Y H:i:s|1305927001)')
->add_column('test1', '$1', 'callback_trim(somecolumn)')
->add_column('test2', '$1', 'callback_str_replace(search|replaced|search content)')
->add_column('test3', '$1', 'callback_str_replace(a|b|column)')
->add_column('test', 'id: $1 and trimmed name: $2', 'id, callback_trim(username)')
->add_column('email', '$1', 'callback_substr(email|0|3)')
->add_column('edit', '$1', 'callback_strtoupper(username)')
->add_column('edit', '$1', 'callback_strtolower(username)')
->add_column('test', '$1', 'callback_nl2br(somecolumn)')
->add_column('test', '$1', 'callback_number_format(1234.567|2)')
->add_column('test', '$1', 'callback_number_format(somecolumn|2)')
->add_column('edit', '$1 $2', 'users.username,callback_number_format(1234.567|2|\,| )') //output : "{username} 1 234,57"
still working on it. any suggestions or ideas will be welcomed ^^
When i finish testing, i will update git.
Edit:
i also wanna add a method that makes possible to modify columns data. For example if we want to hide some parts of data for some security reasons:
->edit_column('email','$1..@..', 'callback_substr(email|0|2)')
edit2: ->edit_column done 😊 it needs some tests before release
edit3: since we have updated the library to v0.5 ‘table.column’ variables turns to ‘column’
Regards,
Yusuf