Jump to content


[SOLVED] Call to a member function callback_before_update() on a non-object

callback

  • Please log in to reply
1 reply to this topic

#1 wenkhairu

wenkhairu

    Member

  • Members
  • PipPip
  • 13 posts

Posted 18 April 2012 - 03:45 AM

hi i have read doc for this one, and still have no answer, unable tu use callback_before_update()
it print Call to a member function callback_before_update() on a non-object
i'm using 1.1.8, here is my function so far

    function daftar_anggota(){
        $this->grocery_crud->set_table('anggota')
        ->set_subject('Daftar Anggota')
        ->columns('nama_anggota','email','no_telp','alamat')
        ->callback_edit_field('password',array($this,'_user_edit'))
        ->display_as('nama_anggota','Nama')
        ->display_as('email','Email')
        ->display_as('no_telp','No Telpon')
        ->display_as('alamat','Alamat')
        ->display_as('password','Password')
        ->display_as('user','Username')
        ->display_as('jenis_kelamin','Jenis Kelamin')
        ->display_as('tempat_lahir','Tempat Lahir')
        ->display_as('tgl_lahir','Tgl Lahir')
        ->display_as('status','Status')
        ->fields('nama_anggota','email','no_telp','alamat','user','password','jenis_kelamin','tempat_lahir','tgl_lahir','status')
        ->required_fields('nama_anggota','email','no_telp','alamat','user','password','jenis_kelamin','tempat_lahir','tgl_lahir','status')
        ->callback_before_insert(array($this,'_md5_pass'))
        ->callback_before_update(array($this,'_md5_pass'));
        $this->_render_halaman($this->grocery_crud->render());
    }


#2 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,099 posts
  • LocationLondon

Posted 18 April 2012 - 06:11 AM

Sorry this is my mistake. It just that I forgot returning $this to all the callbacks methods. ( https://github.com/s...-crud/issues/18 )

So you have two solutions:

The first is to just add all the callbacks differently so for example:

   function daftar_anggota(){
	    $this->grocery_crud->set_table('anggota')
	    ->set_subject('Daftar Anggota')
	    ->columns('nama_anggota','email','no_telp','alamat')
	    ->callback_edit_field('password',array($this,'_user_edit'))
	    ->display_as('nama_anggota','Nama')
	    ->display_as('email','Email')
	    ->display_as('no_telp','No Telpon')
	    ->display_as('alamat','Alamat')
	    ->display_as('password','Password')
	    ->display_as('user','Username')
	    ->display_as('jenis_kelamin','Jenis Kelamin')
	    ->display_as('tempat_lahir','Tempat Lahir')
	    ->display_as('tgl_lahir','Tgl Lahir')
	    ->display_as('status','Status')
	    ->fields('nama_anggota','email','no_telp','alamat','user','password','jenis_kelamin','tempat_lahir','tgl_lahir','status')
	    ->required_fields('nama_anggota','email','no_telp','alamat','user','password','jenis_kelamin','tempat_lahir','tgl_lahir','status');
 
	    $this->grocery_crud->callback_before_insert(array($this,'_md5_pass'));
	    $this->grocery_crud->callback_before_update(array($this,'_md5_pass'));
 
	    $this->_render_halaman($this->grocery_crud->render());
    }

or just update your version with this commit: https://github.com/s...7ff3f6f82ac46da
Posted Image





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users