I am not able to understand what's going wrong in my code
Below is code in my view where Rows are populated from database and edit button set for showing modal popup
Quote
<div class="span12">
<div class="caption">Project Details</div>
<table style="background:#cccccc; margin:0px;">
<thead>
<tr>
<th>Name</th>
<th>Plan (Start-End)</th>
<th>Actual (Start-End)</th>
<th>Description</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach($dpPrjdetails->getData() as $prjdetail) { ?>
<tr class="well">
<td><strong><?php echo $prjdetail->PDSTName ?></strong></td>
<td>
<?php $this->widget('bootstrap.widgets.TbButton', array(
'label'=>'Edit',
'buttonType'=>'button',
'type'=>'inverse',
'size'=>'small',
'htmlOptions'=>array(
'class'=>'editStage',
'data-toggle'=>'modal',
'data-target'=>'#editStageForm',
'data-pdid'=>$prjdetail->PDId,
),
)); ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="caption">Project Details</div>
<table style="background:#cccccc; margin:0px;">
<thead>
<tr>
<th>Name</th>
<th>Plan (Start-End)</th>
<th>Actual (Start-End)</th>
<th>Description</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach($dpPrjdetails->getData() as $prjdetail) { ?>
<tr class="well">
<td><strong><?php echo $prjdetail->PDSTName ?></strong></td>
<td>
<?php $this->widget('bootstrap.widgets.TbButton', array(
'label'=>'Edit',
'buttonType'=>'button',
'type'=>'inverse',
'size'=>'small',
'htmlOptions'=>array(
'class'=>'editStage',
'data-toggle'=>'modal',
'data-target'=>'#editStageForm',
'data-pdid'=>$prjdetail->PDId,
),
)); ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
This is modal div for showing data on popup screen
Quote
<div id="editStageForm" class="modal hide fade in" style="display: none; ">
<div class="modal-header">
<a class="close" data-dismiss="modal">x</a>
<h3>Edit Stage</h3>
</div>
<div class="modal-body">
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',
array('id'=>'prjdetails-update-form',
'type'=>'horizontal','enableAjaxValidation'=>false,)); ?>
<fieldset>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($prjDetailsRec); ?>
<?php echo $form->textFieldRow($prjDetailsRec,'PDSTName',array('size'=>50,'maxlength'=>50)); ?>
<?php echo $form->error($prjDetailsRec,'PDSTName'); ?>
</fieldset>
<div class="form-actions">
<?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit',
'type'=>'primary', 'label'=>'Submit')); ?>
<?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset',
'label'=>'Reset')); ?>
</div>
<?php $this->endWidget(); ?>
</div>
<div class="modal-footer">
</div>
</div>
<div class="modal-header">
<a class="close" data-dismiss="modal">x</a>
<h3>Edit Stage</h3>
</div>
<div class="modal-body">
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',
array('id'=>'prjdetails-update-form',
'type'=>'horizontal','enableAjaxValidation'=>false,)); ?>
<fieldset>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($prjDetailsRec); ?>
<?php echo $form->textFieldRow($prjDetailsRec,'PDSTName',array('size'=>50,'maxlength'=>50)); ?>
<?php echo $form->error($prjDetailsRec,'PDSTName'); ?>
</fieldset>
<div class="form-actions">
<?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit',
'type'=>'primary', 'label'=>'Submit')); ?>
<?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset',
'label'=>'Reset')); ?>
</div>
<?php $this->endWidget(); ?>
</div>
<div class="modal-footer">
</div>
</div>
This is java script code for capturing the row button event
and i have problem here !
Quote
<script type="text/javascript">
$(document).ready(function(){
//editStage
$(document).on("click", ".editStage", function () {
var reckey = $(this).data('pdid');
alert('projdetail id = ' + pdid);
if(reckey){
$.ajax({
url: '<?php echo $this->createUrl('prjectdetails/getstagetask') ?>',
data: 'id='+reckey,
dataType: 'json',
cache: false,
success: function(data) {
if(data) {
alert('got data ' + data.PDSTName);
$(".modal-body #Prjdetails_PDSTName").val(data.PDSTName);
};
};
});
};
});
});
})
</script>
$(document).ready(function(){
//editStage
$(document).on("click", ".editStage", function () {
var reckey = $(this).data('pdid');
alert('projdetail id = ' + pdid);
if(reckey){
$.ajax({
url: '<?php echo $this->createUrl('prjectdetails/getstagetask') ?>',
data: 'id='+reckey,
dataType: 'json',
cache: false,
success: function(data) {
if(data) {
alert('got data ' + data.PDSTName);
$(".modal-body #Prjdetails_PDSTName").val(data.PDSTName);
};
};
});
};
});
});
})
</script>
My alert in jquery is not getting fired don't know why
regards
Girish

Help














