Yii Framework Forum: Cgridview And Ajaxupdate - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cgridview And Ajaxupdate Rate Topic: -----

#1 User is offline   tzoll 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 74
  • Joined: 28-February 13

Posted 08 March 2013 - 09:58 AM

Hello. I've got a question. I try to update content of my div (this is egmap div: #EGMapContainer1) using CGridView and it's ajaxUpdate property. When I try to navigate between records (for example using pagination), content of my div becomes empty (blank). At which point I'm doing wrong? Firebug does not reports ane errors.
This is my code. Thanks
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'maps-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
        'ajaxUpdate'=>'EGMapContainer1',
	'columns'=>array(
		'id',
		'idgatunku',
		'lat',
		'lng',
		'name',
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>
<?php

/* @var $this MapaController */
/* @var $model Mapa */

$map = Maps::model();
$lat = $model->lat;
$lng = $model->lng;
Yii::import('ext.gmap.*');
$gMap = new EGMap();
$gMap->zoom = 2;
$mapTypeControlOptions = array(
  'position'=> EGMapControlPosition::LEFT_BOTTOM,
  'style'=>EGMap::MAPTYPECONTROL_STYLE_DROPDOWN_MENU
);
$gMap->mapTypeControlOptions= $mapTypeControlOptions;
$gMap->setCenter(39.721089311812094, 2.91165944519042);

$dataProvider=$model->search();
  $i = 0;
  if ( $dataProvider->getData() ) {
  foreach ($dataProvider->getData() as $row) {
  $i++;
  // Create marker
  $marker = new EGMapMarker($row['lat'], $row['lng']);
  $gMap->addMarker($marker);
  }
  }
$gMap->enableMarkerClusterer(new EGMapMarkerClusterer());
$gMap->renderMap();
?>

0

#2 User is offline   tzoll 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 74
  • Joined: 28-February 13

Posted 03 April 2013 - 02:13 AM

This is my actual code, can anyone help me?:)

<?php 
$map = $model;
$lat = $model->lat;
$lng = $model->lng;
Yii::import('ext.egmap.*');
$gMap = new EGMap();
$dataProvider=$model->search();
   
$i = 0;
   if ($dataProvider->getData() ) {
   foreach ($dataProvider->getData() as $row) {
   $i++;
   // Create marker
   $marker = new EGMapMarker($row['lat'],$row['lng']);
   $gMap->addMarker($marker);
   }
   }
$gMap->renderMap();
?>

<?php
$this->widget('bootstrap.widgets.TbGridView',array(  
	'dataProvider'=>$model->search(),
        'ajaxUpdate'=>'EGMapContainer1',    
	'columns'=>array(
		'lat',
		'lng',
		array(
			'class'=>'bootstrap.widgets.TbButtonColumn',
                     ),
	),
)); ?>

0

#3 User is offline   Arely 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 15-February 13

Posted 15 April 2013 - 01:58 PM

Hey, I'm trying kinda same thing, just changind format of numbers on my grid. I get the value by getting id of my columnlike this:

'unidad'=>array(
			'name'=>'unidad',
			'value'=>'$data->unidad=$data->tot_labor + $data->tot_material + $data->tot_equipment + $data->tot_subcontract',
			'htmlOptions'=>array('id'=>'uni'),
),


then in the script
var fin = document.getElementById("uni").textContent;
fin = ((parseFloat(fin)).toFixed(2)).replace('.',',');
var datito = document.getElementById("uni");
datito = datito.innerHTML = fin;


The issue here is that it just work for the first data :c
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users