Yii Framework Forum: Yiibooster - Yii Framework Forum

Jump to content

  • (16 Pages)
  • +
  • « First
  • 7
  • 8
  • 9
  • 10
  • 11
  • Last »
  • You cannot start a new topic
  • This topic is locked

Yiibooster Make it gorgeous. Do it Fast. Rate Topic: ***** 6 Votes

#161 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 10 December 2012 - 09:28 PM

View Postjmariani, on 10 December 2012 - 11:07 AM, said:

Hi.

As far as I know, CJuiDatepicker (or other "widgets") cannot be placed with a proper label in front of them (unless I missed something. Highly probable).

I recently proposed a wrapper that fitted my requirement (rendering a CJuiDatePicker as a regular field) but was rejected, so I'm looking for a way to do that without the hassle of extending TbActiveForm, TbInput and the like.

Question is: How to I render a CJuiDatePicker (or whatever widget for that case) like I render other fields (Example: echo $form->fileFieldRow($model, 'fileName');)

Thanks in advance!


As Antonio said why is what's available not good enough? In TbActiveForm you can use datepickerRow(). It will render a date picker with the familiar bootstrap look & feel and imho it's even more user-friendly when one tries to select a different year and month for instance.

If there's something missing for datepickerRow() or could be done better, you should elaborate this?
0

#162 User is offline   jmariani 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 12-January 12

Posted 11 December 2012 - 03:42 PM

View PostAntonio Ramirez, on 10 December 2012 - 05:24 PM, said:

Two of the upcoming widgets are already done on 1.0.6-wip branch... I just wanted to give you an advance

There will be more to come...

PS: After I include the last ones I believe are useful for YiiBooster. Will spend some time to develop the API docs... this is going far too much and we require some proper docs.

Cheers


Thumbs up on Notify!
0

#163 User is offline   jmariani 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 12-January 12

Posted 11 December 2012 - 03:54 PM

View PostDon Felipe, on 10 December 2012 - 09:28 PM, said:

As Antonio said why is what's available not good enough? In TbActiveForm you can use datepickerRow(). It will render a date picker with the familiar bootstrap look & feel and imho it's even more user-friendly when one tries to select a different year and month for instance.

If there's something missing for datepickerRow() or could be done better, you should elaborate this?


Well... here's the story:
1) I want the altField/altFormat functionality of JuiDatePicker.
2) It's not an option to do formatting stuff in beforeSave/afterFind, because I think dates must always be canonical and from the source. altField/altFormat fits the requirement of showing the date in a user friendly way and also POSTing the date in canonical (YYYY-MM-DD).
3) Tried to add that functionality to bootstrap.datepicker, but my JS skills are very poor.
4) JuiDatePicker already have the functionality and I already developed a wrapper to implement altField/altFormat in Yii (it's different from Yii implementation. The widget autocreate the hidden field and set that as the field to be posted. To me, this sounded more practical).

That's why I found myself trying to implement the wrapper in TbActiveForm. First, because I find YiiBooster very good and is my choice for developing UI. Second, because I feel there's an opportunity on discuss and propose improvements. And third, because I cannot understand why widgets like JuiDatpicker (which are obvious field widgets) has to be treated different from other field widgets (or maybe I wasn't smart enough to found it).

Cheers and keep up the good work!
0

#164 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 12 December 2012 - 02:58 PM

Hey @Antonio.

There two things I want to know.

1. Is there a way to have more than on TbEditableColumn in Grid View? How would be a controller action to handle this?

2. I can't get to work the component with Csrf;

'request'=>array(
'enableCsrfValidation'=>true,
0

#165 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 12 December 2012 - 05:59 PM

View Postthiagovidal, on 12 December 2012 - 02:58 PM, said:

Hey @Antonio.

There two things I want to know.

1. Is there a way to have more than on TbEditableColumn in Grid View? How would be a controller action to handle this?

2. I can't get to work the component with Csrf;

'request'=>array(
'enableCsrfValidation'=>true,


Yes you can... and for the CSRF, you will need to add to the update url for the TbEditableColumn setting
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#166 User is offline   johnsnails 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 64
  • Joined: 05-September 11
  • Location:Sydney Australia

Posted 12 December 2012 - 09:48 PM

Hi!

Thanks for the wonderful extension. I am new to Yii and am trying to get the inline edit extension(TbJEditableColumn) working.

ATM, i can double click on a field, it becomes editable, but when I hit enter to save it. It saves with the whole page content inside the field plus the new data I added. I have included some screen shots to explain what I mean.

So my question is how do I get just the updated text to render in the field?

Here is my code, all from admin.php.

<?php $this->widget('bootstrap.widgets.TbExtendedGridView', array(
    'type'=>'striped bordered',
	'dataProvider'=>$model->search(),
    'template' => "{items}",
	'filter'=>$model,
	'columns'=>array(
            array('name'=>'id'),
            array('name'=>'image_name'),
            array(
                'name'=>'image_description',
                'class'=>'bootstrap.widgets.TbJEditableColumn',
                'jEditableOptions'=>array(
                    'type'=>'text',
                    'submitdata'=>array('attribute'=>'image_description'),
                    'cssclass'=>'form',
                    'width'=>'180px'
                )
            ),
            array('name'=>'image_caption'),
            array('name'=>'date_taken'),
            array('name'=>'location'),
            /*
            'metadata',
            */
            array(
                'class'=>'CButtonColumn',
            ),
        )
)); ?>

<?php
$r = Yii::app()->getRequest();
// we can check whether is comming from a specific grid id too
// avoided for the sake of the example
if($r->getParam('editable'))
{
    //echo $r->getParam('attribute');
    echo $r->getParam('value');
    Yii::app()->end();
}
?>


As you can see I am not at the next step of saving the model back to the database, (as a side note, I am not sure how to do that either yet).

Attached File(s)


0

#167 User is offline   Mohit Bhansali 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 12-December 12

Posted 13 December 2012 - 09:09 PM

I want to use Navigation Tabs dynamically i.e. the content will come from database. How to achieve that?

For example, say I've two database tables, named as category and sub-category. When I will click on one category, its sub-category would display using ajax calls. To make it fast and use-friendly, I want to use vertical navigation tabs. Please help.
0

#168 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 16 December 2012 - 09:26 AM

View Postjohnsnails, on 12 December 2012 - 09:48 PM, said:

Hi!

Thanks for the wonderful extension. I am new to Yii and am trying to get the inline edit extension(TbJEditableColumn) working.

ATM, i can double click on a field, it becomes editable, but when I hit enter to save it. It saves with the whole page content inside the field plus the new data I added. I have included some screen shots to explain what I mean.

So my question is how do I get just the updated text to render in the field?

Here is my code, all from admin.php.

<?php $this->widget('bootstrap.widgets.TbExtendedGridView', array(
    'type'=>'striped bordered',
	'dataProvider'=>$model->search(),
    'template' => "{items}",
	'filter'=>$model,
	'columns'=>array(
            array('name'=>'id'),
            array('name'=>'image_name'),
            array(
                'name'=>'image_description',
                'class'=>'bootstrap.widgets.TbJEditableColumn',
                'jEditableOptions'=>array(
                    'type'=>'text',
                    'submitdata'=>array('attribute'=>'image_description'),
                    'cssclass'=>'form',
                    'width'=>'180px'
                )
            ),
            array('name'=>'image_caption'),
            array('name'=>'date_taken'),
            array('name'=>'location'),
            /*
            'metadata',
            */
            array(
                'class'=>'CButtonColumn',
            ),
        )
)); ?>

<?php
$r = Yii::app()->getRequest();
// we can check whether is comming from a specific grid id too
// avoided for the sake of the example
if($r->getParam('editable'))
{
    //echo $r->getParam('attribute');
    echo $r->getParam('value');
    Yii::app()->end();
}
?>


As you can see I am not at the next step of saving the model back to the database, (as a side note, I am not sure how to do that either yet).


The issue is the echoed data at the server... you are actually rendering the whole page again... what you need to return is the actual value that needs to be re-rendered on the edited field column.


If you still have issues, I highly recommend you to use TbEditableColumn is much better and comes an already to use widget for updating automatically the column value.
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#169 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 16 December 2012 - 09:28 AM

View PostMohit Bhansali, on 13 December 2012 - 09:09 PM, said:

I want to use Navigation Tabs dynamically i.e. the content will come from database. How to achieve that?

For example, say I've two database tables, named as category and sub-category. When I will click on one category, its sub-category would display using ajax calls. To make it fast and use-friendly, I want to use vertical navigation tabs. Please help.


Whats the question for YiIBooster? You want to create Tabs dynamically on the frontend scripts or at the PHP script level. Please, elaborate your question a bit more
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#170 User is offline   bit0123 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 75
  • Joined: 01-February 12
  • Location:Bangladesh

Posted 16 December 2012 - 10:04 AM

How to use TbSelect2 wideget?

I am trying to use in the following way:
echo $form->select2Row($model,'container_id','data' => CHtml::listData(Container::model()->findAll(),'id', 'number'));


I have also tried:

echo $form->select2Row($model,'container_id',CHtml::listData(Container::model()->findAll(),'id', 'number'));


But no success.
Thanks in advance...
0

#171 User is offline   timster 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 13-July 12

Posted 16 December 2012 - 10:28 AM

Hi!

I've been using Booster release from 25th of November. Just tried to update it to latest official version & latest github version. With both of these new versions, my modals are not working at all. No javascript errors, they just don't appear (but cause some strange ajax updating). Will try to figure out what's going on there, but would be great if you could point me to right direction ie. has the modal functionality been changed lately (couldn't find any mentioning in Github)? Also pull-right doesn't seem to work with the latest.

Thanks,
Timo
0

#172 User is offline   johnsnails 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 64
  • Joined: 05-September 11
  • Location:Sydney Australia

Posted 16 December 2012 - 08:21 PM

View PostAntonio Ramirez, on 16 December 2012 - 09:26 AM, said:

The issue is the echoed data at the server... you are actually rendering the whole page again... what you need to return is the actual value that needs to be re-rendered on the edited field column.


If you still have issues, I highly recommend you to use TbEditableColumn is much better and comes an already to use widget for updating automatically the column value.


Thanks for your reply Antonio,

As per your suggestion I took a look at TbEditableColumn and have made some more progress.

I do have a question about it though.

On the components.html#editable page it has this example

$this->widget('bootstrap.widgets.TbGridView', array(
	'type' => 'striped bordered',
	'dataProvider' => new CActiveDataProvider('Region',array(
		'criteria'=>array('condition'=>'id < 5'))
	),
	'template' => "{items}",
	'columns' => array(
		'country_code',
		array(
			'class' => 'bootstrap.widgets.TbEditableColumn',
			'name' => 'name',
			'sortable'=>false,
			'editable' => array(
				'url' => $this->createUrl('site/editable'),
				'placement' => 'right',
				'inputclass' => 'span3'
			)
		)),
));


So am I supposed to create a method called editable inside my controller?

So change this line

'url' => $this->createUrl('site/editable'),


to

'url' => $this->createUrl('image/editable'),


or can I use my actionUpdate method inside my image controller like this?

'url' => $this->createUrl('image/update'),


ATM I have it set up to statically update image with id equal to 1 like this:

'url' => $this->createUrl('image/update', array('id'=>'1')),


This updates the frontend but is not retained when the page is refreshed.

Is there anything else I need to do?

Regards,
0

#173 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 16 December 2012 - 10:15 PM

View Postbit0123, on 16 December 2012 - 10:04 AM, said:

How to use TbSelect2 wideget?

I am trying to use in the following way:
echo $form->select2Row($model,'container_id','data' => CHtml::listData(Container::model()->findAll(),'id', 'number'));


I have also tried:

echo $form->select2Row($model,'container_id',CHtml::listData(Container::model()->findAll(),'id', 'number'));


But no success.
Thanks in advance...


You are almost there!

The third parameter needs to be an array containing data as sub-array. Try this:

echo $form->select2Row(
    $model,
    'container_id',
    array(
        'data' => CHtml::listData(Container::model()->findAll(), 'id', 'number'),
        //'options' => array( ... ),
    )
);

0

#174 User is offline   bit0123 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 75
  • Joined: 01-February 12
  • Location:Bangladesh

Posted 16 December 2012 - 11:55 PM

View PostDon Felipe, on 16 December 2012 - 10:15 PM, said:

You are almost there!

The third parameter needs to be an array containing data as sub-array. Try this:

echo $form->select2Row(
    $model,
    'container_id',
    array(
        'data' => CHtml::listData(Container::model()->findAll(), 'id', 'number'),
        //'options' => array( ... ),
    )
);



It Works.
Thank you...
0

#175 User is offline   Mohit Bhansali 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 12-December 12

Posted 17 December 2012 - 04:50 AM

View PostAntonio Ramirez, on 16 December 2012 - 09:28 AM, said:

Whats the question for YiIBooster? You want to create Tabs dynamically on the frontend scripts or at the PHP script level. Please, elaborate your question a bit more


In YIIBooster, tabs content are static. I want to make it dynamic (content from database). Whenever the tabs are clicked, the content will be fetched from database. How do I achieve that?
0

#176 User is offline   bit0123 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 75
  • Joined: 01-February 12
  • Location:Bangladesh

Posted 18 December 2012 - 05:23 AM

Problem with Form in Modal(TbModal)

I have rendered a form in the Modal body using renderpartial.
The form is for creating new 'product' object.

But the validation is not working also the default 'create' button in
the form does not working.

Please help.
Thanks in advance.
0

#177 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 18 December 2012 - 08:46 AM

View Postbit0123, on 18 December 2012 - 05:23 AM, said:

Problem with Form in Modal(TbModal)

I have rendered a form in the Modal body using renderpartial.
The form is for creating new 'product' object.

But the validation is not working also the default 'create' button in
the form does not working.

Please help.
Thanks in advance.


Please post your view file/s and controller actions and any error messages (firebug/php) if any.
0

#178 User is offline   bit0123 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 75
  • Joined: 01-February 12
  • Location:Bangladesh

Posted 18 December 2012 - 09:23 AM

View PostDon Felipe, on 18 December 2012 - 08:46 AM, said:

Please post your view file/s and controller actions and any error messages (firebug/php) if any.


Thanks for your intention.

This is the view file where i have render another view in Moodal body
...
...
...
<?php $this->beginWidget('bootstrap.widgets.TbModal', array('id'=>'myModal')); ?>
 
    <div class="modal-header">
        <a class="close" data-dismiss="modal">x</a>
    <h4>Add New Product:</h4>
    </div>
 
<div class="modal-body">
    <?php echo $this->renderPartial('//containerproduct/form', array('model'=>new Containerproduct,'c_id'=>$model->id)); ?>
</div>
 
<div class="modal-footer">
	<?php $this->widget('bootstrap.widgets.TbButton', array(
		'label'=>'Cancel',
		'url'=>'#',
		'htmlOptions'=>array('data-dismiss'=>'modal'),
	)); ?>
</div>
<?php $this->endWidget(); ?>
	<?php $this->widget('bootstrap.widgets.TbButton', array(
	'label'=>'Add Product to this Container',
	'type'=>'primary',
	'htmlOptions'=>array(
		'data-toggle'=>'modal',
		'data-target'=>'#myModal',
	),
)); ?>



The view file which i have rendered:

<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
	'id'=>'containerproduct-form',
	'type'=>'horizontal',
	'enableAjaxValidation'=>true,
	'clientOptions'=>array(
			'validateOnSubmit'=>true,
		),
)); ?>

	<p class="help-block">Fields with <span class="required">*</span> are required.</p>
		
	
	<?php echo $c_id;echo $form->errorSummary($model); ?>
	 
	<?php echo $form->hiddenField($model,'container_id',array('value'=>$c_id)); ?>
	
	<div class='well'>
	<?php echo $form->select2Row($model,'product_id',array('data'=>CHtml::listData(Product::model()->findAll(),'id','name'), 'options' => array('width'=>'33%'))); ?>
		
	<?php echo $form->textFieldRow($model,'number',array('class'=>'span5','maxlength'=>10)); ?>

	<?php echo $form->textFieldRow($model,'waste',array('class'=>'span5','maxlength'=>10, 'default'=>0)); ?>

	<?php //echo $form->textFieldRow($model,'net',array('class'=>'span5','maxlength'=>10)); ?>

	<div class="form-actions">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
			'label'=>$model->isNewRecord ? 'Create' : 'Save',
		)); ?>
	</div>
	</div>
<?php $this->endWidget(); ?>



And In the Controller i have not done any change.

Snap is added also...

Attached File(s)

  • Attached File  up.png (37.12K)
    Number of downloads: 44

0

#179 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 18 December 2012 - 10:12 AM

View Postbit0123, on 18 December 2012 - 09:23 AM, said:

And In the Controller i have not done any change.


If you're not telling the action to validate the form data... it won't!

To keep things simple, use the same action as for the main view/page and add the following accordingly:

public function actionIndex() //replace with your action name
{
  $containerproduct = new Containerproduct;
	 	
  // if it is ajax validation request
  if(isset($_POST['ajax']) && $_POST['ajax']=='containerproduct-form')
  {
    echo CActiveForm::validate($containerproduct);
    Yii::app()->end(); //important here!!!
  }

  //rest of action code... 

  //add $containerproduct to render()...
}


Then, change the first param of renderPartial() in your main view to:

'model'=>$containerproduct

This will do the trick and validation plus button should work now.
Of course, data is only validated but not yet saved.
0

#180 User is offline   bit0123 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 75
  • Joined: 01-February 12
  • Location:Bangladesh

Posted 19 December 2012 - 05:29 AM

@Don Felipe Thanks for your reply.

I have solved the problem through defining the form action.
0

Share this topic:


  • (16 Pages)
  • +
  • « First
  • 7
  • 8
  • 9
  • 10
  • 11
  • Last »
  • You cannot start a new topic
  • This topic is locked

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