Yii Framework Forum: [EXTENSION] EUpdateDialog - Yii Framework Forum

Jump to content

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] EUpdateDialog Rate Topic: ***** 1 Votes

#1 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 08 August 2011 - 11:08 AM

This is the topic for EUpdateDialog extension.

If you have questions or found a bug let me know.
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#2 User is offline   traceshankar 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 03-November 10

Posted 09 August 2011 - 07:20 AM

Couple of things i want to know about this extension.

1) In my form i have three text box and i need to make sure this three fields are filled up before open the dialog. I have tried in the below mentioned way to put validation by calling function validateForm , alert message opens out but still dialog appears. Any way to overcome this ?



echo CHtml::link('Add Trip Details', '#', 
 
              array(
                     'class'=>'update-dialog-create',
                     'onclick'=>'js:validateForm();return false;',
 
               )
 
                );



2) My scenario is that i need to display records in cgridview based on criteria. After record got created via dialog , cgridview does not show the updated value. Please help me on this issues.

$criteria = new CDbCriteria;
		$criteria->select = 'transport_code';
		$criteria->condition='identifier_key=:identifierKey';
		$criteria->params=array(':identifierKey'=>"'".trim($unique_id)."'");
		$criteria->group = 'transport_code';
		$criteria->order = 'trip_id';
			
		$dataProvider=new CActiveDataProvider('TempIntTripDetails', array(
							'criteria'=>$criteria));
			
			
	
	$this->widget( 'zii.widgets.grid.CGridView', array(
 	'id'=>'int-driver-form-grid',
	'dataProvider'=>$dataProvider,
	
	'columns' => array(
	
		'transport_code',

    array(
      'class' => 'CButtonColumn',
      'deleteButtonUrl' => 'Yii::app()->createUrl("/driverwagescal/internaldriver/TempIntTripDetails/delete",array( "id" => $data->trip_id) )',
      'updateButtonUrl' => 'Yii::app()->createUrl("/driverwagescal/internaldriver/TempIntTripDetails/update",array( "id" => $data->trip_id) )',
      'buttons' => array(
        'delete' => array(
    	//  'deleteConfirmation' => true,
          'click' => 'updateDialogDelete',
    	   
        ),
        'update' => array(
          'click' => 'updateDialogUpdate',
        ),
      ),
    ),
  ),
)); 





Appreciate your help on this issue.
0

#3 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 09 August 2011 - 12:41 PM

1) I'm not sure I completely understand the situation, but as far as I get it it's impossible to do what you want, because there is no form to validate. The form is loaded only after you click the create button, but the empty form will be loaded.

On the other though, a different scenario might be that you want to open some other form with dialog on the page which already have some form. I would probably suggest expanding default create function, or adding your own on binding it to create link as I think it would be easier to maintain, but you can do something similar to this
'onclick' => 'js:$(this).unbind(\'click\');alert(\'bu\');return false;'
(that's probably a very bad idea as you won't have a click event anymore on the link. But I would suggest just writing your own function, you will get much more flexibility.

This code is not tested, but you will probably want to add something like this:
function updateDialogCreateMine( e ){
  e.preventDefault();
  if( validateForm() === true )
    updateDialogActionBase( $( this ).attr( 'href' ), 'Create' );
  else
    alert( 'Fill the form' );
}

jQuery( function($){
  $( 'a.update-dialog-create-mine' ).bind( 'click', updateDialogCreateMine );
});


2) I made some kind of clone on my app from your provided code and for me it updated. There might be something wrong with a criteria itself or with a cgridview (as I was testing my custom gridview, I run into problems, which I later tested on cgridview, and it doesn't always work as it is supposed when using pager filter and so on together). Also don't forget to change line 54 in EUpdateDialog.js if you are using different class or tag name for gridview.
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#4 User is offline   traceshankar 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 03-November 10

Posted 09 August 2011 - 10:04 PM

View Postandrew2mar, on 09 August 2011 - 12:41 PM, said:

1) I'm not sure I completely understand the situation, but as far as I get it it's impossible to do what you want, because there is no form to validate. The form is loaded only after you click the create button, but the empty form will be loaded.

On the other though, a different scenario might be that you want to open some other form with dialog on the page which already have some form. I would probably suggest expanding default create function, or adding your own on binding it to create link as I think it would be easier to maintain, but you can do something similar to this
'onclick' => 'js:$(this).unbind(\'click\');alert(\'bu\');return false;'
(that's probably a very bad idea as you won't have a click event anymore on the link. But I would suggest just writing your own function, you will get much more flexibility.

This code is not tested, but you will probably want to add something like this:
function updateDialogCreateMine( e ){
  e.preventDefault();
  if( validateForm() === true )
    updateDialogActionBase( $( this ).attr( 'href' ), 'Create' );
  else
    alert( 'Fill the form' );
}

jQuery( function($){
  $( 'a.update-dialog-create-mine' ).bind( 'click', updateDialogCreateMine );
});


2) I made some kind of clone on my app from your provided code and for me it updated. There might be something wrong with a criteria itself or with a cgridview (as I was testing my custom gridview, I run into problems, which I later tested on cgridview, and it doesn't always work as it is supposed when using pager filter and so on together). Also don't forget to change line 54 in EUpdateDialog.js if you are using different class or tag name for gridview.



It seems problem is in criteria . Things are working correctly if i did not use the criteria so that means no issue with the class or tag name. Can you pass me the sample code using with criteria for reference ? Appreciate your help .
0

#5 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 10 August 2011 - 01:52 AM

View Posttraceshankar, on 09 August 2011 - 10:04 PM, said:

It seems problem is in criteria . Things are working correctly if i did not use the criteria so that means no issue with the class or tag name. Can you pass me the sample code using with criteria for reference ? Appreciate your help .


I just made simple select with simple condition, to make sure it updates, won't be of any help. I would suggest to turn on the logs, and just get on with the debugging to try and find the problem.
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#6 User is offline   traceshankar 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 03-November 10

Posted 10 August 2011 - 08:59 PM

View Postandrew2mar, on 10 August 2011 - 01:52 AM, said:

I just made simple select with simple condition, to make sure it updates, won't be of any help. I would suggest to turn on the logs, and just get on with the debugging to try and find the problem.



Thanks for your help. I am trying to sort out this issue. I will update the post once i find the solution.
0

#7 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 11 August 2011 - 01:17 AM

View Posttraceshankar, on 10 August 2011 - 08:59 PM, said:

Thanks for your help. I am trying to sort out this issue. I will update the post once i find the solution.


Maybe check your $unique_id it might be something different than you expect. Another "solution" if you are using autoincrementing id would be to order your query by this id in descending order. Just an idea, it might need more polishing.
Good luck solving this issue.
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#8 User is offline   traceshankar 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 03-November 10

Posted 15 August 2011 - 04:23 AM

Hi,

I am using random generated unique id to keep track of the records which i got created in dialog page. After record got created via dialog , i found that cgridview got updated in ajax mode by calling url like "
/index.php/driverwagescal/internaldriver/DriverWagesRecords/create?ajax=int-driver-form-grid
. Since i am generating the unique id on each page request, everytime i am getting different unique id. How to overcome this issue ? Any idea ?

Thanks in advance.
0

#9 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 15 August 2011 - 04:39 AM

View Posttraceshankar, on 15 August 2011 - 04:23 AM, said:

Hi,

I am using random generated unique id to keep track of the records which i got created in dialog page. After record got created via dialog , i found that cgridview got updated in ajax mode by calling url like "
/index.php/driverwagescal/internaldriver/DriverWagesRecords/create?ajax=int-driver-form-grid
. Since i am generating the unique id on each page request, everytime i am getting different unique id. How to overcome this issue ? Any idea ?

Thanks in advance.


Hi,

How about returning generated unique id after creating a record, and sending it with gridview (through hidden field or something like that)?
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#10 User is offline   pituspace 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 10-August 11

Posted 18 August 2011 - 09:14 AM

Hi,

If I put widget CTabView into view - it display first tab correctly but switching is not working.

$this->widget('CTabView',array('tabs'=>array(
	'tab1'=>array('title'=>'Search'), 
	'tab2'=>array('title'=>'Advanced Search')
)));


Any idea?
0

#11 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 18 August 2011 - 11:53 AM

View Postpituspace, on 18 August 2011 - 09:14 AM, said:

Hi,

If I put widget CTabView into view - it display first tab correctly but switching is not working.

$this->widget('CTabView',array('tabs'=>array(
	'tab1'=>array('title'=>'Search'), 
	'tab2'=>array('title'=>'Advanced Search')
)));


Any idea?


Hi,

Sorry I can't help with that, as I haven't used CTabView anywhere so I actually don't even know how they work.
I would suggest debuging using Firebug console and see there it goes, as most problems working with AJAX happens because of JS errors, wrong url or parameter.

Best of luck with trying to find the solution.
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#12 User is offline   pituspace 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 10-August 11

Posted 23 August 2011 - 09:40 AM

I need a hint,

After opening dialog window with multiple widgets, content are "drawed" (especially EJuiComboBox). Is there any possible to first load content (not the window), and then show?

Regards!


(sorry for my english)
0

#13 User is offline   pituspace 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 10-August 11

Posted 23 August 2011 - 09:47 AM

View Postandrew2mar, on 18 August 2011 - 11:53 AM, said:

I would suggest debuging using Firebug console and see there it goes, as most problems working with AJAX happens because of JS errors, wrong url or parameter.


The widget simply don't emit any errors (also in firebug). I'll write if I find something.
0

#14 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 23 August 2011 - 10:30 AM

View Postpituspace, on 23 August 2011 - 09:40 AM, said:

I need a hint,

After opening dialog window with multiple widgets, content are "drawed" (especially EJuiComboBox). Is there any possible to first load content (not the window), and then show?

Regards!


(sorry for my english)


If I understand correctly you want to display dialog only after all the contents of this dialog is loaded?
That way you could add an ajax loader or 'Loading' text to the content and replace it after all the content finished loading. Or move the opening of the dialog in ajax call.
I'm aware that loading additional widgets, gets the 'drawing' effect, and fixing it is my todo list, but as I'm currently busy with other stuff, I won't be looking into that for at least another week or so.
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#15 User is offline   Sanjay 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 28-February 10

Posted 24 August 2011 - 12:27 PM

It's a great extension! Thanks.
I'm working on an application with a single controller but multiple models. The view provides link to add/update different models. I tried it with one model. It works great! I've a question - Upon "close" of the dialog, I'd like to call another controller action to refresh partial changes as a result of the dialog. Please help me out with the java script code here.
0

#16 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 25 August 2011 - 04:06 AM

View PostSanjay, on 24 August 2011 - 12:27 PM, said:

It's a great extension! Thanks.
I'm working on an application with a single controller but multiple models. The view provides link to add/update different models. I tried it with one model. It works great! I've a question - Upon "close" of the dialog, I'd like to call another controller action to refresh partial changes as a result of the dialog. Please help me out with the java script code here.


I won't be able to help you with JavaScript as I'm not very good with it (never find time to take a good book and learn it, so I learn it as I go), however if I had to do something like this, I would probably be looking into expanding Ajax success call, by returning additional content and replacing existing with it, or by making another Ajax call to return new content and replacing old content with it, depending on which one would be more appropriate.
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#17 User is offline   jpablo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 18-August 11
  • Location:Rosario, Argentina

Posted 03 September 2011 - 01:14 AM

I started using EUpdateDialog but I found that the CREATE dialog does not show the datepicker jquery component in the date fields. The original CRUD was created using GIIX. How can I use the EUpdateDialog ext maintaining the original behavior (date field using datepicker)?

The pre-existent view code has a GxActiveForm as follows:

<?php $form = $this->beginWidget('GxActiveForm', array(
'id' => 'postal-form',
'enableAjaxValidation' => false,
));
?>
<p class="note">
<?php echo Yii::t('app', 'Fields with'); ?> <span class="required">*</span> <?php echo Yii::t('app', 'are required'); ?>.
</p>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'cod_postal'); ?>
<?php echo $form->textField($model, 'cod_postal'); ?>
<?php echo $form->error($model,'cod_postal'); ?>
</div><!-- row -->
<div class="row">
<?php echo $form->labelEx($model,'localidad'); ?>
<?php echo $form->textField($model, 'localidad', array('maxlength' => 64)); ?>
<?php echo $form->error($model,'localidad'); ?>
</div><!-- row -->
<div class="row">
<?php echo $form->labelEx($model,'date'); ?>
<?php $form->widget('zii.widgets.jui.CJuiDatePicker', array(
'model' => $model,
'name'=>'Postal[bb]',
'value'=>Yii::app()->lc->toLocal($model->bb, 'date', 'small'),
'options' => array('changeYear' => true,'dateFormat'=>Yii::app()->locale->getDateFormat('calendar_small')),
));
; ?>
<?php echo $form->error($model,'bb'); ?>
</div><!-- row -->
0

#18 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 03 September 2011 - 04:15 AM

View Postjpablo, on 03 September 2011 - 01:14 AM, said:

I started using EUpdateDialog but I found that the CREATE dialog does not show the datepicker jquery component in the date fields. The original CRUD was created using GIIX. How can I use the EUpdateDialog ext maintaining the original behavior (date field using datepicker)?


Thanks for letting me know. I use custom clientScript component so it works for me, but with default Yii clientScript component it doesn't work. The problem is that for some reason it doesn't run the jquery-ui widget initialization after retrieving contents. I will be making an update to the extension in a week or so, I will have to look for a solution for this problem.
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#19 User is offline   jpablo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 18-August 11
  • Location:Rosario, Argentina

Posted 03 September 2011 - 09:32 AM

View Postandrew2mar, on 03 September 2011 - 04:15 AM, said:

Thanks for letting me know. I use custom clientScript component so it works for me, but with default Yii clientScript component it doesn't work. The problem is that for some reason it doesn't run the jquery-ui widget initialization after retrieving contents. I will be making an update to the extension in a week or so, I will have to look for a solution for this problem.


Oh, I see.. Many thanks, you made a very nice work, you are a great contributor to this comunity, I'm personally grateful =) I'll wait for your update in order to move forwar with my development.
BTW, I have a little suggestion. The first time I click a "add new model" link the dialog opens with no content, a moment later the dialog is filled with the content (retrieved with AJAX).There is a little delay of around two seconds to draw the dialog content. That's OK, but the end user is in doubt for a couple of seconds, because there is nothing indicating that the dialog is loading contents. Maybe a simple animated "loading" icon while the ajax-retrieved form content is loaded will be enough to make a little enhance of the end user experience.
0

#20 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 03 September 2011 - 09:51 AM

View Postjpablo, on 03 September 2011 - 09:32 AM, said:

Oh, I see.. Many thanks, you made a very nice work, you are a great contributor to this comunity, I'm personally grateful =) I'll wait for your update in order to move forwar with my development.
BTW, I have a little suggestion. The first time I click a "add new model" link the dialog opens with no content, a moment later the dialog is filled with the content (retrieved with AJAX).There is a little delay of around two seconds to draw the dialog content. That's OK, but the end user is in doubt for a couple of seconds, because there is nothing indicating that the dialog is loading contents. Maybe a simple animated "loading" icon while the ajax-retrieved form content is loaded will be enough to make a little enhance of the end user experience.


I think the problem is with jQuery UI. It's not the first problem I had with jQuery UI and also other this library widgets aren't initializing either.
Thanks, it's great you like it :)
Yes, I noticed that it's missing a 'loading' message|icon, so it's already on my to-do list. I was thinking about updating it little by little, but decided to finish my first Yii app, and then I'll start polishing my app I will also make a big update to this extension. So it should be coming in a week or two, as there are still some work to be done, also if making a design won't make me too depressed like it happened the last time :D
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

Share this topic:


  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

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