Forum

May 22nd, 2014
A A A

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS Related Topics
renderGrid() only displays first row
22/08/2011
19:40
itsame69
New Member
Forum Posts: 2
Member Since:
19/08/2011
Offline

Hi,

I am evaluating jqGrid for a project that we are currently working on. The first task is to integrate jqSuite for PHP into a Zend Framework project. After some debugging this works.

However, I'm currently having the following problem: I'm using the following lines of code (in my Controller) to initialize jqGrid:

        $this->_gridConn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
        $this->_grid = new jqGridRender($this->_gridConn);
        $this->_grid->SelectCommand = 'SELECT id, firma, vorname, nachname, telefon, plz, ort FROM b_kunden';
        $this->_grid->table = 'b_kunden';
        $this->_grid->dataType = 'json';
        $this->_grid->setPrimaryKeyId('id');
        $this->_grid->setColModel();
        $this->_grid->setUrl('/kunden/fetchdata');
        $this->_grid->setGridOptions(array(
            "rowNum"=>10,
            "rowList"=>array(10,20,30),
            "sortname"=>"id"
        ));
        $this->_grid->setColProperty('id', array("editoptions"=>array("readonly"=>true)));
        $this->_grid->navigator = true;
        $this->_grid->setNavOptions('navigator', array("excel"=>false,"add"=>true,"edit"=>true,"del"=>true,"view"=>true, "search"=>true));
        $this->_grid->setNavOptions('edit',array("closeAfterEdit"=>true,"editCaption"=>"Update Customer","bSubmit"=>"Update"));
        $this->view->grid = $this->_grid;

The corresponding view simply renders the Grid:

<?php $this->grid->renderGrid('#grid','#pager',true, null, null, true,true); ?>

And last but not least, this Action returns the data:

         $rows = array('0' => array('id' => '1', 'firma' => 'test', 'vorname' => 'Christian', 'nachname' => 'Meier', 'telefon' => '+43 699 66666666', 'plz' => '9020', 'ort' => 'Klagenfurt'),
                      '1' => array('id' => '21', 'firma' => 'test', 'vorname' => 'Andreas', 'nachname' => 'Dreier', 'telefon' => '+43 699 66666666', 'plz' => '9020', 'ort' => 'Klagenfurt'),
                      '2' => array('id' => '2', 'firma' => 'test', 'vorname' => 'Hubert', 'nachname' => 'Feier', 'telefon' => '+43 699 66666666', 'plz' => '9020', 'ort' => 'Klagenfurt'),
                       '3' => array('id' => '13', 'firma' => 'test', 'vorname' => 'Horst', 'nachname' => 'Heier', 'telefon' => '+43 699 66666666', 'plz' => '9020', 'ort' => 'Klagenfurt'));

        $response['page'] = 1;
        $response['total'] = 1;
        $response['records'] = 3;
        $i=0;
        foreach ($rows as $r) {
            $response['rows'][$i]['id']=$r['id']; //id
            $response['rows'][$i]['cell']=array($r['id'],$r['firma'],$r['vorname'],$r['nachname'],$r['telefon'],$r['plz'],$r['ort']);
            $i++;
        }
        echo Zend_Json::encode($response);

The problem is, that this renders something like:

As you can see, the ID is displayed but all the other data is missing (i.e. not rendered). Any help or hint would be appreciated very much!

Thanks

      Christian

22/08/2011
19:58
itsame69
New Member
Forum Posts: 2
Member Since:
19/08/2011
Offline

Solved the problem. Actually, I simply forgot to define the jsonReader using setGridOption().

27/09/2012
11:56
bailamj
Member
Forum Posts: 3
Member Since:
27/09/2012
Offline

Can you  put the code correctly?

I have this problem but.. nothing...

Forum Timezone: Europe/Sofia

Most Users Ever Online: 215

Currently Online:
40 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1233

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11310

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10521

Posts: 31067

Newest Members: jhardt1, HamidM, thaiphong.pham, walloud, theo121, trollbits

Moderators: tony: 7641, Rumen[Trirand]: 81

Administrators: admin: 61

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information