jQuery UI Widgets Forums Grid Grid not passing pagenum value to the controller

This topic contains 1 reply, has 2 voices, and was last updated by  Stanislav 6 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • danangeloalcanar
    Participant

    Hello Community,

    I am having a small problem with grid and serverside pager.

    I am using CodeIgniter and MS SQL.

    I followed the tutorial about paging. I am able to retrieve data from MS SQL.

    But I can’t make the server side pager work. It seems the grid is not passing the pagenum value to my controller. The pagesize is working. The grid retrieves data from the server when I change the pagesize. It seems like when I click the next and previous button, nothing is passed to the server.

      var source =
      {
        type: 'POST',
        datatype: "json",
        datafields:
        [
          { name: 'customerCode', type: 'number' },
          { name: 'customerName', type: 'string' }
        ],
        url: baseUrl,
        root: 'Rows',
        beforeprocessing: function(data)
        {
          source.totalrecords = data[0].TotalRows;
        }
      };
      var dataadapter = new $.jqx.dataAdapter(source);
      console.log(dataadapter);
      $("#customers").jqxGrid({
            width: 600,
            source: dataadapter,
            autoheight: true,
            pageable: true,
            virtualmode: true,
            pagesizeoptions: ['50', '100', '250', '1000', '10000'],
            rendergridrows: function()
            {
                return dataadapter.records;
            },
          columns: [
            { text: 'Customer Code', datafield: 'customerCode', width: 250 },
            { text: 'Customer Name', datafield: 'customerName', width: 250 },
          ]
      });
    });
    
    	public function fetchCustomers() {
    			$pagenum =$this->input->post('pagenum');
    			$pagesize =$this->input->post('pagesize');
    
    			$start = $pagenum * $pagesize;
    			$result = $this->indexmodel->fetchCustomers($pagenum, $pagesize);
    			foreach ($result as $row) {
    				$customers[] = [
    					'customerCode' => $row['customerCode'],
    					'customerName' => $row['customerName']
    				];
    			}
    			$data[] = [
    				'TotalRows' => count($result),
    				'Rows' => $customers
    			];
    			echo json_encode($data);
    	}

    Would you help me with this? Thank you so much! 🙂

    Love from Philippines,
    Dan


    Stanislav
    Participant

    Hello Dan,

    Have you tested to see if an event is thrown, when you press the buttons?

    You could also take a look at this example, it might help you.
    Link

    Best Regards,
    Stanislav

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.