Wednesday, January 27, 2016

Select2 get update value

input type hidden value and get value in ID

jQuery(function($) {
 //var selectedValues = val(subject;?>).split(',');
 var selectedsub = $("#subjectval").val().split(',');
 var selectedrelevant_law = $("#relevant_lawval").val().split(',');
 var selectedsectionval = $("#relevant_sectionval").val().split(',');
 var selectedcourtval = $("#courtval").val().split(',');
 var selectedjudgeval = $("#judgeval").val().split(',');
 var selectedadvocateval = $("#advocateval").val().split(',');
 $("#subject").select2().select2('val',selectedsub);
 $("#relevant_law").select2().select2('val',selectedrelevant_law);
 $("#relevant_section").select2().select2('val',selectedsectionval);
 $("#court").select2().select2('val',selectedcourtval);
 $("#judge").select2().select2('val',selectedjudgeval);
 $("#advocate").select2().select2('val',selectedadvocateval);

});


Tuesday, January 19, 2016

Yii countByAttributes or findAllByAttributes

    return $count = InstituteClassSummary::model()->countByAttributes(
    array(
      'zillaid' => $zilaid,
    ),
    array(
    //  'order' => 'date desc',
      'group' => 'institude_id',
    //  'offset' => 15
    ));

$allLogins = InstituteClassSummary::model()->findAllByAttributes(
array(
    'zillaid' => Yii::app()->user->id,
    'type' => $zilaid
),
array(
    'order' => 'date desc',
    'limit' => 10,
    'offset' => 15
));