Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





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

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
renderGrid() only displays first row
22/08/2011
19:40
Avatar
itsame69
New Member
Members
Forum Posts: 2
Member Since:
19/08/2011
sp_UserOfflineSmall 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:

Image Enlarger

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
Avatar
itsame69
New Member
Members
Forum Posts: 2
Member Since:
19/08/2011
sp_UserOfflineSmall Offline

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

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

Can you  put the code correctly?

I have this problem but.. nothing...

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
64 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information