Yiibooster

Recently launched YiiBooster, YiiBooster is a collection of widgets that will ease the task of developing Yii applications, as well as, giving your application a little boost. Basically, YiiBooster tackles the most common challenges that Yii developers face while trying to enhance their applications.

Please, use this forum topic for questions about its use. For issues and bugs, please use Github: https://github.com/clevertech/YiiBooster/issues

Problem with TbPercentOfTypeGooglePieOperation in TbExtendedGridView

First of all thanks for this great extension.

I am trying to implementing TbPercentOfTypeGooglePieOperation in TbExtendedGridView and my environment is:

A table named ‘User’ with a field ‘join_date’ and having CRUD generated.


'extendedSummary' => array(

        'title' => 'join_date Statistics',

        'columns' => array(

	        'join_date' => array(

		        'label'=>'join_date Statistics',

		        'types' => array(

			        User::model()->findAll(array(

						'select'=>'join_date',

						'distinct'=>true,

					),'join_date','join_date'),

		        ),

		        'class'=>'TbPercentOfTypeGooglePieOperation',

	        )

        )

    ),

CException: The "label" of a type must be defined.

How to define the type for my case?

Please help…

As you can see on the following example:




'types' => array(

			        'CSS'=>array('label'=>'Css'),

			        'JavaScript'=>array('label'=>'Js'),

			        'HTML'=>array('label'=>'html')

		        ),



The types are an array where the ‘KEYS’ are actually the values to check for and they are required to have a label property set in an array. You are just returning an array of CActiveRecords and that doesnt work like this. I recommend you to create afunction that returns the types array as stated above.

In order to get the correct configuration array, I highly recommend you to check the code of the widget TbPercentOfTypeGooglePieOperation that is written within the TbExtendedGridView widget.

Pardon me to suggest a new widget from combination with jqgrid.

I am really interest on some ext that really complete with js tool and css

Thank

JQGrid is an excellent tool, but we would like to keep the Bootstrap lookalike and nowadays JQGrid has issues with this theme. If you find a way to include the widget with the possibility to have Bootstrap theme and does not have issues and/or conflicts. They will be added to it.

I have a question in regards to themeing/customization and using LESS. If I wanted to customize my theme (pretty much adjusting everything found in the “Customize Variables” section in the Twitter Bootstrap download page), what’s the best way to do it? Would it be to just customize it from Twitter Bootstrap? What about the other CSS that’s not TB related (e.g. jquery-ui related ones, bootstrap-yii.less?)?

What’s the safest way to make sure my customizations are applied throughout the entire library? Is it with LESS? And if so, do we just grab the *.less source files from Twitter Bootstrap and go from there?

I guess I’m looking for some kind of guide :)

Anyway, awesome work (and much thanks to Chris for kicking off the original extension)! I love the ease of use and functionality of Twitter Bootstrap and these extensions… but I’m horrible at applying a theme that will make my site a bit different from the other TB-based sites out there

The library references to *.css files (check assets folder of the extension), I know that .less is a cool way to do many things, but I tend to use tools like: http://stylebootstrap.info/ which easiest my work on customizing… Also, Booster has many references to many libraries that do not use .less… I guess we need some volunteers to make such huge transformation.

Cheers

hai antonio, thanks for your nice extension…

i use "tbjeditablecolumn" in my tbextendedgridview, its work fine… but when i post "id" that start with "0", it cant read "0".

Ex : my id = "01122", when i check the post id with firebug, post id = "1122".

how can i fix this problem?

thanks…

Hi,

Area: YiiBooster

Widget: TblActiveForm

Issue: TblDatePicker

I cannot seem to display dates in UK format (dd/mm/yyyy) - the model attribute is loading the date in UK format, I am using this code:


echo $form->datepickerRow($model, 'date_inception',

        array('hint'=>'Policy start date' 

        , 'prepend'=>'<i class="icon-calendar"></i>' 

        , 'format' => 'dd/mm/yyyy' 

        , 'weekStart'=> 1

        )) ; 

The page is rendering this js all the time though…


jQuery('#UwLocalPolicy_date_inception').datepicker({'language':'en_us','format':'mm/dd/yyyy','weekStart':0});

Any ideas appreciated. Ideally I want to use this YiiBooster component rather than the CJuiDatePicker.

Thanks,

Peter, Liverpool

The php extension seems to hardcode the date format even though it appears to take a format option.

In order to use DatePicker plugin and some other widgets that require configuration options, please within the htmlOptions the ‘options’ key with the array of configuration options of that widget:




echo $form->datepickerRow($model, 'date_inception',

        array('hint'=>'Policy start date' 

        , 'prepend'=>'<i class="icon-calendar"></i>' 

        , 'options'=>array('format' => 'dd/mm/yyyy' , 'weekStart'=> 1)

        )) ;



When you have issues with other plugins, please check TbInputVertical and TbInputHorizontal to review the way different options are taken from htmlOptions to construct the widget. This was included in order to maintain bc widgets construction with Bootstrap library.

Could you provide code example? Thanks!

Hola Antonio,

You deserve your ‘elite’ status :) thanks that worked perfectly. Lastly, is there a way to get the picker to close once a date is clicked? I have to click away at the moment.

Gracias!

Peter

i have problem with Relation data when i use TbEditableCOlumn, can u help me please, thanx for the answer

this is my code





    $this->widget('bootstrap.widgets.TbGridView', array(

        'type'=>'striped bordered condensed',

	    'id'=>'isistok-grid',

	    'dataProvider'=>$model->searchStok(10),

        'filter'=>$model,

        'enableSorting'=>false,

        'enablePagination' => true,

        'pager' => array(

            'cssFile' => false,

            'header' => false,

            'firstPageLabel' => 'First',

            'prevPageLabel' => 'Previous',

            'nextPageLabel' => 'Next',

            'lastPageLabel' => 'Last',

        ),        

	    'columns'=>array(

            array(

                'header'=>'No.',

                    'value'=>'$this->grid->dataProvider->pagination->currentPage*

                    $this->grid->dataProvider->pagination->pageSize + $row+1',

                'htmlOptions'=>array('style'=>'text-align:center'),

            ),            

            array(

                'name'=>'tgl',

                'header'=>'Tanggal',

                'value'=>'date("d-m-Y H:i:s",strtotime($data->tgl))',

                'htmlOptions'=>array('style'=>'text-align:center'),

            ),  

            

            array(

                'class' => 'bootstrap.widgets.TbEditableColumn',

                'name' => 'idBarang0.idJenisBarang0.nama', --> Error in this

                'sortable'=>false,

                'editable' => array(

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

                    'placement' => 'right',

                    'inputclass' => 'span3'

                )

            ),



my relation table in the picture, what i want is data from jenisbarang->nama, in cgridview it work fine, but with TbEditableColumn, it cant detect relation

this is debug result





Querying SQL: SELECT `idBarang0`.`idBarang` AS `t1_c0`,

`idBarang0`.`idJenisBarang` AS `t1_c1`, `idBarang0`.`idUserLogin` AS

`t1_c2`, `idBarang0`.`nama` AS `t1_c3`, `idBarang0`.`lokasi` AS `t1_c4`,

`idBarang0`.`kode` AS `t1_c5`, `idBarang0`.`modal` AS `t1_c6`,

`idBarang0`.`laba` AS `t1_c7`, `idBarang0`.`jumlah` AS `t1_c8`,

`idBarang0`.`terjual` AS `t1_c9` FROM `barang` `idBarang0`  WHERE

(`idBarang0`.`idBarang`=:ypl0). Bound with :ypl0=NULL

in

D:\htdocs\plath\protected\extensions\bootstrap\widgets\TbEditableColumn.php

(45)

in D:\htdocs\plath\protected\views\transaksi\isiStok\admin.php (279)

in D:\htdocs\plath\protected\controllers\TransaksiController.php (89)

in D:\htdocs\plath\protected\modules\rights\components\RController.php (36)

in D:\htdocs\plath\index.php (18)

 


i dont know what about other editable, are they like this too (cant detect AR) ?

Thats the way the plugin works… for that to happen, you will have to modify the actual jquery plugin code.

TbEditableColumn is extended from TbDataColumn > CDataColumn, so, could you please check whether the relation works with simple column before? I guess there is an issue with your SQL.

Cheers

Your relation is bound to an ID= NULL




// ON YOUR DEBUG!!!!


SELECT `idBarang0`.`idBarang` AS `t1_c0`,

`idBarang0`.`idJenisBarang` AS `t1_c1`, `idBarang0`.`idUserLogin` AS

`t1_c2`, `idBarang0`.`nama` AS `t1_c3`, `idBarang0`.`lokasi` AS `t1_c4`,

`idBarang0`.`kode` AS `t1_c5`, `idBarang0`.`modal` AS `t1_c6`,

`idBarang0`.`laba` AS `t1_c7`, `idBarang0`.`jumlah` AS `t1_c8`,

`idBarang0`.`terjual` AS `t1_c9` FROM `barang` `idBarang0`  WHERE

(`idBarang0`.`idBarang`=:ypl0). Bound with :ypl0=NULL <----- SEE? 




this is my code in search function i use


public function searchStok(&#036;baris)


{


	// Warning: Please modify the following code to remove attributes that


	// should not be searched.





	&#036;criteria=new CDbCriteria;





	&#036;criteria-&gt;compare('idBarangDetailMasuk',&#036;this-&gt;idBarangDetailMasuk);


	&#036;criteria-&gt;compare('idBarang',&#036;this-&gt;idBarang);


	&#036;criteria-&gt;compare('idUserLogin',&#036;this-&gt;idUserLogin);


	&#036;criteria-&gt;compare('DATE_FORMAT(t.tgl,&quot;%d-%m-%Y %H:%i:%s&quot;)',&#036;this-&gt;tgl,true);


	&#036;criteria-&gt;compare('t.jumlah',&#036;this-&gt;jumlah,true);


	&#036;criteria-&gt;compare('nama',&#036;this-&gt;nama,true);


	&#036;criteria-&gt;compare('jns.nama',&#036;this-&gt;jenis,true);





    &#036;criteria-&gt;select = array(


        't.jumlah as jumlah',


        'DATE_FORMAT(t.tgl,&quot;%d-%m-%Y %H:%i:%s&quot;) as tgl',


        'brg.nama as nama', 


        'jns.nama as jenis',


        '(brg.modal+brg.laba) as harga', 


        'ifnull(sum(brg.jumlah-brg.terjual),0) as stok',


    ); 


    &#036;criteria-&gt;with = array(


        'idBarang0'=&gt;array(


            'select'=&gt;array(),


            'alias'=&gt;'brg',


            'with'=&gt;array(


                'idJenisBarang0'=&gt;array(


                    'select'=&gt;array(),


                    'alias'=&gt;'jns',


                ),


            ),


            'together'=&gt;true,


        ),


    );


    &#036;criteria-&gt;alias='t';


    &#036;criteria-&gt;together=true;


    &#036;criteria-&gt;group='t.idBarangDetailMasuk';


    &#036;criteria-&gt;having='stok&gt;0';


    &#036;criteria-&gt;order='t.tgl desc';


    


    


    


	return new CActiveDataProvider(&#036;this, array(


		'criteria'=&gt;&#036;criteria,


        'pagination'=&gt;array(


            'pageSize'=&gt;&#036;baris,


        ),


	));


}

in cgridview i can call this

        array(


            'name'=&gt;'jenis',


            'header'=&gt;'Jenis',


            'value'=&gt;'&#036;data-&gt;jenis',


            'htmlOptions'=&gt;array('style'=&gt;'text-align:center'),


        ),  

but when i change to this

        array(


            'class' =&gt; 'bootstrap.widgets.TbEditableColumn',


            'name' =&gt; 'jenis',


            'sortable'=&gt;false,


            'editable' =&gt; array(


                'url' =&gt; &#036;this-&gt;createUrl('site/editable'),


                'placement' =&gt; 'right',


                'inputclass' =&gt; 'span3'


            )


        ),

it say error (Model "Barangdetailmasuk" does not have attribute "jenis" ),

what must i do if data contain relation with other table ?

this is my code :




$this->widget('bootstrap.widgets.TbExtendedGridView',array(

	'id'=>'kbki-subklas-grid',

	'dataProvider'=>$model->search(),

	'filter'=>$model,

	'type'=>'striped bordered',

	'columns'=>array(

		'id',

		array(

            'name'=>'deskripsi',

	          'class'=>'bootstrap.widgets.TbJEditableColumn',

            'saveURL'=>$this->createUrl('myUrl),

			'jEditableOptions' => array(

	            'type' => 'text',

				'submitdata' => array('attribute'=>'deskripsi'),

	            'cssclass' => 'form',

	            'width' => '200px',

			),

        ),

		array(

			'class'=>'bootstrap.widgets.TbButtonColumn',

		),

	),

));



i use bootstrap generator and every "_search.php" form will give button like this :





	<div class="form-actions">

		<?php $this->widget('bootstrap.widgets.TbButton', array(

			'type'=>'primary',

			'label'=>'Search',

		)); ?>

	</div>



because that button not a submit button when i click button, it dont do search. I think its better to change generate code to :




	<div class="form-actions">

		<?php $this->widget('bootstrap.widgets.TbButton', array(

			'buttonType'=>'submit',

			'type'=>'primary',

			'label'=>'Search',

		)); ?>

	</div>



add ‘buttonType’=>‘submit’,

thanks…