Welcome Guest, Not a member yet? Register   Sign In
Edit Inline problem
#1

[eluser]jiahui[/eluser]
Recently, I found a useful edit inline jquery solution and would like to use in codeIgniter framework.

Following are my project codes:

Controller Page :
Code:
<?php

class Eximporter extends MY_Controller {

    function Eximporter()
    {
        parent::MY_Controller();
        $this->load->model('eximporter_model');

    }
    // --------------------------------------------------------------------

    function index($message = '')
    {
        $data['extraHeadContent']= "[removed][removed]\n";
        $data['extraHeadContent'].= "<link type=\"text/css\" rel=\"stylesheet\" href=\"". base_url()."css/eximporter.css\" />\n";
        $data['extraHeadContent'].= "[removed][removed]\n";
        $data['extraHeadContent'].= "[removed][removed]\n";
        
        $data['message'] = $message;
        $data['exporters'] = $this->eximporter_model->get_exporters_details();
        $data['totalrecords'] = $this->eximporter_model->countnoofexporters();
        
        $this->load->view('eximporter/index', $data);

    }

    // --------------------------------------------------------------------
    function updateinfo()
    {
        $id = ($this->input->get_post('id')) ? (int) $this->input->get_post('id') : $this->uri->segment(3);

        $this->eximporter_model->update_address1_details();
        

    }

    // --------------------------------------------------------------------
View page:

Code:
<?php foreach($exporters->result() as $ppl):?>            
                <h3>&lt;?php echo $ppl->firstname.' '.$ppl->lastname; ?&gt;</h3>
                <p><font style="font-family:Arial; font-size:12px;"><strong>Address 1 :</strong></font> <b class="editable_textarea" style="display: inline">&lt;?php echo $ppl->address1 ?&gt;</b>
                <br /><br /><font style="font-family:Arial; font-size:12px;"><strong>Address 2 :</strong></font>
                <br /><br /><font style="font-family:Arial; font-size:12px;"><strong>Address 3 :</strong></font></p>
            &lt;?php endforeach;?&gt;

I am not sure how to pass the data id and value to updateinfo page. But I include editInline.js like this:

I used firebug to troubleshoot, I can see textarea value there but id no. Any idea about this?

Code:
$(function() {
  $(".editable_textarea").editable("eximporters/updateinfo?id=&lt;?php echo $ppl->id ?&gt;", {
      indicator : "<img src='../images/root_sys_admin.png'>",
      type   : 'textarea',
      submitdata: { _method: "put" },
      select : true,
      submit : 'OK',
      cancel : 'cancel',
      cssclass : "editable"
  });

});
#2

[eluser]jedd[/eluser]
In your view:

s/class/id/

Though having duplicate ID's (because it's within a foreach) is likely to be unsatisfying. You'll probably just want to append an integer or some other handy identifier to the ID string.
#3

[eluser]jiahui[/eluser]
Thank you for your explanation. It really works to me.

By the way, do you have any idea to set style css of textarea form like its col and row sizes?




Theme © iAndrew 2016 - Forum software by © MyBB