Yii Framework Forum: Modal Popup For Updating And Adding Row To Datagrid - Yii Framework Forum

Jump to content

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

Modal Popup For Updating And Adding Row To Datagrid Rate Topic: -----

#1 User is offline   Girish Awate 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 23-January 13
  • Location:Mumbai

Posted 01 March 2013 - 03:50 PM

Hi
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>


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>


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>

My alert in jquery is not getting fired don't know why

regards
Girish
0

#2 User is offline   macinville 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 268
  • Joined: 25-October 10
  • Location:Marikina City, Philippines

Posted 01 March 2013 - 08:45 PM

It's also difficult to understand your code buddy. Please use the code block when posting (the <> sign in the editor) so it's more eye-friendly.

If you are using firefox browser, use firebug extension to debug your issue. If you're still not able to solve your problem, just post here the error and ONLY the necessary portion of your codes so you can encourage more readers to read your post :)
Tell your tail.
Don't be shy to upvote a post if it was able to help you
0

#3 User is offline   Balu 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 09-August 11
  • Location:Kerala, India

Posted 02 March 2013 - 12:41 AM

Hey You can use this extension
http://www.yiiframew...rudgiitemplate/

This will also help you.
http://stackoverflow...it-button-click
0

#4 User is offline   Girish Awate 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 23-January 13
  • Location:Mumbai

Posted 02 March 2013 - 08:49 AM

View Postmacinville, on 01 March 2013 - 08:45 PM, said:

It's also difficult to understand your code buddy. Please use the code block when posting (the <> sign in the editor) so it's more eye-friendly.

If you are using firefox browser, use firebug extension to debug your issue. If you're still not able to solve your problem, just post here the error and ONLY the necessary portion of your codes so you can encourage more readers to read your post :)


I have updated my code as you said
can you understand it now,
ask me if anything you cannot get
regards
0

#5 User is offline   macinville 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 268
  • Joined: 25-October 10
  • Location:Marikina City, Philippines

Posted 03 March 2013 - 10:46 PM

There is an extra "})" at the bottom of your script. Try removing that and see if that fixes your problem. It will also help if you can post here the error message you are encountering.
Tell your tail.
Don't be shy to upvote a post if it was able to help you
0

#6 User is offline   Girish Awate 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 23-January 13
  • Location:Mumbai

Posted 05 March 2013 - 12:30 PM

Thanks for all the help, it was the typo error
::)
0

#7 User is offline   macinville 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 268
  • Joined: 25-October 10
  • Location:Marikina City, Philippines

Posted 08 March 2013 - 10:26 PM

:)
Tell your tail.
Don't be shy to upvote a post if it was able to help you
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