Answer the question
In order to leave comments, you need to log in
How to get around conflict between pqgrid and yii2 js scripts?
b.widget is not a function[Подробнее] pqgrid.min.js:9:6815
$(...).pqGrid is not a function
В AppAsset:
public $css = [
'css/site.css',
'bootstrap-select/css/bootstrap-select.min.css',
'selectic/selectik.css',
'tags/bootstrap-tagsinput.css',
'css/font_icons.css',
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/base/jquery-ui.css',
'grid_master/pqgrid.min.css',
];
public $js = [
'bootstrap-select/js/bootstrap-select.min.js',
'scripts.js',
'selectic/jquery.selectik.js',
'selectic/jquery.selectik.min.js',
'selectic/jquery.selectik.js',
'selectic/jquery.mousewheel.js',
'tags\bootstrap-tagsinput.js',
'jquery_csv/jquery.csv.js',
'preloader/preloader.js',
'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js',
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js',
'grid_master/pqgrid.min.js'
<?php
$script = <<< JS
$(function(){
var data = [ [1,'Exxon Mobil','339,938.0','36,130.0'],
[2,'Wal-Mart Stores','315,654.0','11,231.0'],
[3,'Royal Dutch Shell','306,731.0','25,311.0'],
[4,'BP','267,600.0','22,341.0'],
[5,'General Motors','192,604.0','-10,567.0'],
[6,'Chevron','189,481.0','14,099.0'],
[7,'DaimlerChrysler','186,106.3','3,536.3'],
[8,'Toyota Motor','185,805.0','12,119.6'],
[9,'Ford Motor','177,210.0','2,024.0'],
[10,'ConocoPhillips','166,683.0','13,529.0'],
[11,'General Electric','157,153.0','16,353.0'],
[12,'Total','152,360.7','15,250.0'],
[13,'ING Group','138,235.3','8,958.9'],
[14,'Citigroup','131,045.0','24,589.0'],
[15,'AXA','129,839.2','5,186.5'],
[16,'Allianz','121,406.0','5,442.4'],
[17,'Volkswagen','118,376.6','1,391.7'],
[18,'Fortis','112,351.4','4,896.3'],
[19,'Crédit Agricole','110,764.6','7,434.3'],
[20,'American Intl. Group','108,905.0','10,477.0']];
var obj = {};
obj.width = 700;
obj.height = 400;
obj.colModel = [{title:"Rank", width:100, dataType:"integer"},
{title:"Company", width:200, dataType:"string"},
{title:"Revenues ($ millions)", width:150, dataType:"float", align:"right"},
{title:"Profits ($ millions)", width:150, dataType:"float", align:"right"}];
obj.dataModel = {data:data};
$("#grid_json").pqGrid( obj );
});
$('button').click(function() {
var url=$(this).attr('data-url');
$.ajax({
type:'post',
url:url,
}).done(function(response) {
$('#contents').html(response);
});
});
JS;
$this->registerJs($script);
?>
Answer the question
In order to leave comments, you need to log in
Decide on the version of jquery, select one of the versions.
'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js',
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js',
public $js = []
public $depends = []
what is written in the block?
Why did you decide that this is a conflict? Mistake about another
It is possible, but it also needs to be connected correctly. In particular, make sure jquery is connected before your script that depends on it. I think it's in the wrong connection, and not in conflicts. How did you connect?
Make sure the order of the scripts is correct. In particular Jquery before everything else.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question