Does anyone know why this code with the CJuiDialog widget does not cause an error
<script type="text/javascript">
//Inventory Details
$(function() {
var $dialog = $('<div id="inventory-details"></div>');
$dialog.dialog({
title: 'Show data',
autoOpen: false,
modal: true,
//position: ['center', 'top'],
width: 'auto',
height: 'auto',
});
$('table.items a').click(function() {
$dialog.load($(this).attr('href')).dialog('open');
return false;
});
$('.ui-widget-overlay').live('click', function() {
$('#inventory-details').dialog( "close" );
});
});
</script>
<h1>Current Inventory</h1>
Please check our inventory regularly to see our current offerings.
<?php
/*$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
));*/
$this->beginWidget('zii.widgets.jui.CJuiDialog',array(
'id'=>'juiDialog',
'options'=>array(
'title'=>'Show data',
'autoOpen'=>false,
'modal'=>true,
'width'=>'auto',
'height'=>'auto',
),
));
$this->endWidget();
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'template' => "{pager}\n{items}\n{pager}",
'ajaxUpdate' => false,
'pager'=>array(
'header' => '',
'prevPageLabel' => '< previous',
'nextPageLabel' => 'next >',
),
'columns'=>array(
array(
'name'=>'',
'type'=>'html',
'value'=>'CHtml::link(CHtml::image(Yii::app()->baseURL.\'/images/inventory/thumb/\' . $data->thumb),array(\'/inventory/\'.$data->id))',
),
array(
'name'=>'make',
'type'=>'html',
'value'=>'CHtml::encode($data->make) . CHtml::tag(\'br\') . CHtml::encode($data->body) . CHtml::tag(\'p\') . CHtml::link("View Details" ,array(\'/inventory/\'.$data->id))',
),
'model',
'engine',
'trans',
array(
'name'=>'Stock Number',
'type'=>'html',
'value'=>'"JD" . CHtml::encode($data->id)',
),
'price',
),
));
?>
while this code without it causes a $dialog.dialog is not a function error?
<script type="text/javascript">
//Inventory Details
$(function() {
var $dialog = $('<div id="inventory-details"></div>');
$dialog.dialog({
title: 'Show data',
autoOpen: false,
modal: true,
//position: ['center', 'top'],
width: 'auto',
height: 'auto',
});
$('table.items a').click(function() {
$dialog.load($(this).attr('href')).dialog('open');
return false;
});
$('.ui-widget-overlay').live('click', function() {
$('#inventory-details').dialog( "close" );
});
});
</script>
<h1>Current Inventory</h1>
Please check our inventory regularly to see our current offerings.
<?php
/*$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
));*/
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'template' => "{pager}\n{items}\n{pager}",
'ajaxUpdate' => false,
'pager'=>array(
'header' => '',
'prevPageLabel' => '< previous',
'nextPageLabel' => 'next >',
),
'columns'=>array(
array(
'name'=>'',
'type'=>'html',
'value'=>'CHtml::link(CHtml::image(Yii::app()->baseURL.\'/images/inventory/thumb/\' . $data->thumb),array(\'/inventory/\'.$data->id))',
),
array(
'name'=>'make',
'type'=>'html',
'value'=>'CHtml::encode($data->make) . CHtml::tag(\'br\') . CHtml::encode($data->body) . CHtml::tag(\'p\') . CHtml::link("View Details" ,array(\'/inventory/\'.$data->id))',
),
'model',
'engine',
'trans',
array(
'name'=>'Stock Number',
'type'=>'html',
'value'=>'"JD" . CHtml::encode($data->id)',
),
'price',
),
));
?>