• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error after integrate with adminlte

#1
hello all!! thank you in advance for any help you can provide.

i have a little codeigniter project with grocery crud and mysql. it is working fine but i want to use adminlte in order to add new features.

im working with adminlte blank page template

versions-------------------------------------------
codeigniter 3.1.9
grocerucrud 1.6.3
adminlte 2

dir sctructure---------------------------------------
httdocs
-----------web
-----------------assets
--------------------------adminlte

controller------------------------------------------------------------------------------------------------------------------


PHP Code:
public function f_cargadatos($v_where=null) { 
try {

$v_where "mhwh_fk_etarea!='Cancelado' AND mhwh_fk_etarea!='Vencido' AND mhwh_fk_etarea!='Realizado'";

$crud = new grocery_CRUD();
$this->load->config('grocery_crud');
$this->config->set_item('grocery_crud_file_upload_allow_file_types','gif|jpeg|jpg|png|pdf');
$crud->set_theme('datatables');
$crud->set_table('t_mhw_header');                                  
$crud
->set_subject('Movimiento HW');
$crud->where($v_where);

$crud->required_fields('mhwh_id_ticket','mhwh_fhrealizacion','mhwh_fk_etarea');

$crud->columns(array( 'id_mhwh' 'mhwh_fk_cliente' 'mhwh_reponsable'  'mhwh_id_ticket' 'mhwh_fk_sala' 'mhwh_fk_etarea''mhwh_observaciones'));

$crud->fields('mhwh_id_ticket''mhwh_fhrealizacion''mhwh_fk_edificio''mhwh_fk_sala''mhwh_reponsable''mhwh_fk_cliente' 'mhwh_observaciones''mhwh_firma''mhwh_fk_ssff''mhwh_fk_etarea''mhwh_creator','mhwh_updater');

$crud->field_type('mhwh_creator''invisible');
$crud->field_type('mhwh_updater''invisible');
                                                                                                          
$crud
->set_relation('mhwh_fk_tdocumento' ,'lst_tipo_documentos' ,'id_tdocumentos'      );
$crud->set_relation('mhwh_fk_etarea'        ,'lst_estado_tareas' ,'id_estado_tarea');
$crud->set_relation('mhwh_reponsable' ,'lst_responsables'        ,'id_resp_nombre');
$crud->set_relation('mhwh_fk_ssff'            ,'lst_operariosssff'          ,'id_opersssff');
$crud->set_relation('mhwh_fk_sala'            ,'lst_salas'          ,'id_salas');
$crud->set_relation('mhwh_fk_edificio' ,'lst_edificios'          ,'id_edificios');
$crud->set_relation('mhwh_fk_cliente' ,'lst_clientes','id_cliente');

$crud->set_rules ('mhwh_id_ticket','Solicitud N°','trim|alpha_numeric_spaces|required');
$output $crud->render ();                
$this
->_load_outputHead($output);

}catch(
Exception $e) { show_error($e->getMessage().' --- ‘. $e->getTraceAsString());  }}

public function _load_outputHead($output = null)
{          $this->load->view('
app_3wmhw/view’, (array)$output); } 

view-----------------------------------------------------------------------------------------------------------------------

PHP Code:
<?php $this->load->view('app_3widc/vh_3widc'); ?>

    <!-- Main content -->
    <section class="content">

      <!-- Default box -->
      <div class="box">
        <div class="box-header with-border">
          <h3 class="box-title">Title</h3>

          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip"
                    title="Collapse">
              <i class="fa fa-minus"></i></button>
    </div>
        </div>
        <div class="box-body">


            <div class="box">
              <div class="box-header with-border">
                <h3 class="box-title">Collapsible Box Example</h3>
                <div class="box-tools pull-right">
                  <!-- Collapse Button -->
                  <button type="button" class="btn btn-box-tool" data-widget="collapse">
                    <i class="fa fa-minus"></i>
                  </button>
                </div>
                <!-- /.box-tools -->
              </div>              <!-- /.box-header -->
              <div class="box-body">  


                        <!-- BODY  --------------------------------------------------------------------------------------------- -->
                        <div class="w3-display-container">
                            <div class="w3-display-middle w3-large " id=" body" style="padding: 10px;" >  
                                  <?php echo $output;  ?>
                            </div>
                        </div>
                        <!-- FIN_BODY------------------------------------------------------------------------------------------------- -->


              </div>
            </div>            <!-- /.box -->
        </div>        <!-- /.box-body -->
        <div class="box-footer">  Footer  </div>        <!-- /.box-footer-->
      </div>      <!-- /.box -->
    </section>    <!-- /.content -->
  </div>  <!-- /.content-wrapper -->


<?php $this->load->view('app_3widc/vf_3widc'); ?>

error----------------------------------------------------------------------------------------------------------------------
Uncaught TypeError: $(...).dataTable is not a function
    at loadDataTable (datatables.js:141)
    at HTMLTableElement.<anonymous> (datatables.js:59)
    at Function.each (jquery.min.js:2)
    at w.fn.init.each (jquery.min.js:2)
    at HTMLDocument.<anonymous> (datatables.js:52)
    at j (jquery-1.11.1.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-1.11.1.min.js:2)
    at Function.ready (jquery-1.11.1.min.js:2)
    at HTMLDocument.J (jquery-1.11.1.min.js:2)


tries---------------------------------------------------------
add all jquery loads at the end of adminlte "after jquery was loaded"




PHP Code:
<!-- jQuery 3  -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/jquery/dist/jquery.min.js"></script>
<!-- 
Bootstrap 3.3.7 -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- 
SlimScroll -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- 
FastClick -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/fastclick/lib/fastclick.js"></script>
<!-- 
AdminLTE App -->
<
script src="<?php echo base_url();?>assets/adminlte/dist/js/adminlte.min.js"></script>
<!-- 
AdminLTE for demo purposes -->
<
script src="<?php echo base_url();?>assets/adminlte/dist/js/demo.js"></script>
<!--
      GROCERY CRUD 
      
<script src="<?php echo base_url();?>assets/grocery_crud/js/jquery-1.11.1.min.js"></script>
-->
<
script src="<?php echo base_url();?>assets/grocery_crud/js/common/list.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/ui/jquery-ui-1.10.3.custom.min.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/jquery.dataTables.min.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/datatables-extras.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/datatables.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/extras/TableTools/media/js/ZeroClipboard.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/extras/TableTools/media/js/TableTools.min.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/jquery.fancybox-1.3.4.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/jquery.easing-1.3.pack.js"></script




Any ideas?
im not developer but i will try to answer all your questions to anyone interested in help me

best regards

**EDIT: added code tags for readability! **
Reply

#2
For one your loading jQuery twice, once for AdminLTE and then your loading it again
for Grocery CRUD. So you are over writing the first jQuery with an older version.

I would download the newest jQuery version 3.3.1 and just use it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(10-03-2019, 08:05 AM)InsiteFX Wrote: For one your loading jQuery twice, once for AdminLTE and then your loading it again
for Grocery CRUD. So you are over writing the first jQuery with an older version.

I would download the newest jQuery version 3.3.1 and just use it.

thank you very much for your answer but 2nd "load" 


PHP Code:
<!--
GROCERY CRUD
<script src="<?php echo base_url();?>assets/grocery_crud/js/jquery-1.11.1.min.js"></script>
--> 



is really necesary update JQUERY? do you think that will solve all problems?
this code without adminlte works fine

and JQUERY version loaded is that one comes with adminlte template
Reply

#4
Your loading jQuery twice, see below.

PHP Code:
<!-- jQuery 3  -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/jquery/dist/jquery.min.js"></script> <!-- HERE FIRST LOAD OF JQUERY -->
<!-- 
Bootstrap 3.3.7 -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- 
SlimScroll -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- 
FastClick -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/fastclick/lib/fastclick.js"></script>
<!-- 
AdminLTE App -->
<
script src="<?php echo base_url();?>assets/adminlte/dist/js/adminlte.min.js"></script>
<!-- 
AdminLTE for demo purposes -->
<
script src="<?php echo base_url();?>assets/adminlte/dist/js/demo.js"></script>
<!--
      GROCERY CRUD 
      
<script src="<?php echo base_url();?>assets/grocery_crud/js/jquery-1.11.1.min.js"></script> <!-- HERE SECOND LOAD OF JQUERY -->
-->
<
script src="<?php echo base_url();?>assets/grocery_crud/js/common/list.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/ui/jquery-ui-1.10.3.custom.min.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/jquery.dataTables.min.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/datatables-extras.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/datatables.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/extras/TableTools/media/js/ZeroClipboard.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/extras/TableTools/media/js/TableTools.min.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/jquery.fancybox-1.3.4.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/jquery.easing-1.3.pack.js"></script

See the remarks on the far right.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#5
(10-03-2019, 05:52 PM)InsiteFX Wrote: Your loading jQuery twice, see below.

PHP Code:
<!-- jQuery 3  -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/jquery/dist/jquery.min.js"></script> <!-- HERE FIRST LOAD OF JQUERY -->
<!-- 
Bootstrap 3.3.7 -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- 
SlimScroll -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- 
FastClick -->
<
script src="<?php echo base_url();?>assets/adminlte/bower_components/fastclick/lib/fastclick.js"></script>
<!-- 
AdminLTE App -->
<
script src="<?php echo base_url();?>assets/adminlte/dist/js/adminlte.min.js"></script>
<!-- 
AdminLTE for demo purposes -->
<
script src="<?php echo base_url();?>assets/adminlte/dist/js/demo.js"></script>
<!--
      GROCERY CRUD 
      
<script src="<?php echo base_url();?>assets/grocery_crud/js/jquery-1.11.1.min.js"></script> <!-- HERE SECOND LOAD OF JQUERY -->
-->
<
script src="<?php echo base_url();?>assets/grocery_crud/js/common/list.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/ui/jquery-ui-1.10.3.custom.min.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/jquery.dataTables.min.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/datatables-extras.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/datatables.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/extras/TableTools/media/js/ZeroClipboard.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/extras/TableTools/media/js/TableTools.min.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/jquery.fancybox-1.3.4.js"></script>
<
script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/jquery.easing-1.3.pack.js"></script

See the remarks on the far right.

thank you InsiteFX, you were right. i thought that line was commented but no. i've deleted and still getting problems loading grocery crud datatables. i keep googling and waiting for some help.-
checking adminlte requirements it runs with jquery1.11+ same that grocery crud
Reply

#6
I run AdminLTE using jQuery 3.3.1 just fine.

If you run into problems jQuery has a migrate utility for it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.