Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
dba03031
Commit
dba03031
authored
Mar 03, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2596 from tonydspaniard/2559-pjax-filter
2559 pjax filter
parents
7fd3415a
f5cc851f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
yii.gridView.js
framework/assets/yii.gridView.js
+15
-12
No files found.
framework/CHANGELOG.md
View file @
dba03031
...
@@ -49,6 +49,7 @@ Yii Framework 2 Change Log
...
@@ -49,6 +49,7 @@ Yii Framework 2 Change Log
-
Bug #2502: Unclear error message when
`$_SERVER['DOCUMENT_ROOT']`
is empty (samdark)
-
Bug #2502: Unclear error message when
`$_SERVER['DOCUMENT_ROOT']`
is empty (samdark)
-
Bug #2519: MessageSource removed translation messages when event handler was bound to
`missingTranslation`
-event (cebe)
-
Bug #2519: MessageSource removed translation messages when event handler was bound to
`missingTranslation`
-event (cebe)
-
Bug #2527: Source language for
`app`
message category was always
`en`
no matter which application
`sourceLanguage`
was used (samdark)
-
Bug #2527: Source language for
`app`
message category was always
`en`
no matter which application
`sourceLanguage`
was used (samdark)
-
Bug #2559: Going back on browser history breaks GridView filtering with
`Pjax`
(tonydspaniard)
-
Bug: Fixed
`Call to a member function registerAssetFiles() on a non-object`
in case of wrong
`sourcePath`
for an asset bundle (samdark)
-
Bug: Fixed
`Call to a member function registerAssetFiles() on a non-object`
in case of wrong
`sourcePath`
for an asset bundle (samdark)
-
Bug: Fixed incorrect event name for
`yii\jui\Spinner`
(samdark)
-
Bug: Fixed incorrect event name for
`yii\jui\Spinner`
(samdark)
-
Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe)
-
Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe)
...
...
framework/assets/yii.gridView.js
View file @
dba03031
...
@@ -26,17 +26,18 @@
...
@@ -26,17 +26,18 @@
filterSelector
:
undefined
filterSelector
:
undefined
};
};
var
gridData
=
{};
var
methods
=
{
var
methods
=
{
init
:
function
(
options
)
{
init
:
function
(
options
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$e
=
$
(
this
);
var
$e
=
$
(
this
);
var
settings
=
$
.
extend
({},
defaults
,
options
||
{});
var
settings
=
$
.
extend
({},
defaults
,
options
||
{});
$e
.
data
(
'yiiGridView'
,
{
gridData
[
$e
.
prop
(
'id'
)]
=
{
settings
:
settings
};
settings
:
settings
});
var
enterPressed
=
false
;
var
enterPressed
=
false
;
$
(
settings
.
filterSelector
).
on
(
'change.yiiGridView keydown.yiiGridView'
,
function
(
event
)
{
$
(
document
).
off
(
'change.yiiGridView keydown.yiiGridView'
,
settings
.
filterSelector
)
.
on
(
'change.yiiGridView keydown.yiiGridView'
,
settings
.
filterSelector
,
function
(
event
)
{
if
(
event
.
type
===
'keydown'
)
{
if
(
event
.
type
===
'keydown'
)
{
if
(
event
.
keyCode
!==
13
)
{
if
(
event
.
keyCode
!==
13
)
{
return
;
// only react to enter key
return
;
// only react to enter key
...
@@ -60,7 +61,7 @@
...
@@ -60,7 +61,7 @@
applyFilter
:
function
()
{
applyFilter
:
function
()
{
var
$grid
=
$
(
this
);
var
$grid
=
$
(
this
);
var
settings
=
$grid
.
data
(
'yiiGridView'
)
.
settings
;
var
settings
=
gridData
[
$grid
.
prop
(
'id'
)]
.
settings
;
var
data
=
{};
var
data
=
{};
$
.
each
(
$
(
settings
.
filterSelector
).
serializeArray
(),
function
()
{
$
.
each
(
$
(
settings
.
filterSelector
).
serializeArray
(),
function
()
{
data
[
this
.
name
]
=
this
.
value
;
data
[
this
.
name
]
=
this
.
value
;
...
@@ -85,15 +86,16 @@
...
@@ -85,15 +86,16 @@
setSelectionColumn
:
function
(
options
)
{
setSelectionColumn
:
function
(
options
)
{
var
$grid
=
$
(
this
);
var
$grid
=
$
(
this
);
var
data
=
$grid
.
data
(
'yiiGridView
'
);
var
id
=
$
(
this
).
prop
(
'id
'
);
data
.
selectionColumn
=
options
.
name
;
gridData
[
id
]
.
selectionColumn
=
options
.
name
;
if
(
!
options
.
multiple
)
{
if
(
!
options
.
multiple
)
{
return
;
return
;
}
}
$grid
.
on
(
'click.yiiGridView'
,
"input[name='"
+
options
.
checkAll
+
"']"
,
function
()
{
var
inputs
=
"#"
+
id
+
" input[name='"
+
options
.
checkAll
+
"']"
;
$
(
document
).
off
(
'click.yiiGridView'
,
inputs
).
on
(
'click.yiiGridView'
,
inputs
,
function
()
{
$grid
.
find
(
"input[name='"
+
options
.
name
+
"']:enabled"
).
prop
(
'checked'
,
this
.
checked
);
$grid
.
find
(
"input[name='"
+
options
.
name
+
"']:enabled"
).
prop
(
'checked'
,
this
.
checked
);
});
});
$
grid
.
on
(
'click.yiiGridView'
,
"input[name='"
+
options
.
name
+
"']
:enabled"
,
function
()
{
$
(
document
).
off
(
'click.yiiGridView'
,
inputs
+
":enabled"
).
on
(
'click.yiiGridView'
,
inputs
+
"
:enabled"
,
function
()
{
var
all
=
$grid
.
find
(
"input[name='"
+
options
.
name
+
"']"
).
length
==
$grid
.
find
(
"input[name='"
+
options
.
name
+
"']:checked"
).
length
;
var
all
=
$grid
.
find
(
"input[name='"
+
options
.
name
+
"']"
).
length
==
$grid
.
find
(
"input[name='"
+
options
.
name
+
"']:checked"
).
length
;
$grid
.
find
(
"input[name='"
+
options
.
checkAll
+
"']"
).
prop
(
'checked'
,
all
);
$grid
.
find
(
"input[name='"
+
options
.
checkAll
+
"']"
).
prop
(
'checked'
,
all
);
});
});
...
@@ -101,7 +103,7 @@
...
@@ -101,7 +103,7 @@
getSelectedRows
:
function
()
{
getSelectedRows
:
function
()
{
var
$grid
=
$
(
this
);
var
$grid
=
$
(
this
);
var
data
=
$grid
.
data
(
'yiiGridView'
)
;
var
data
=
gridData
[
$grid
.
prop
(
'id'
)]
;
var
keys
=
[];
var
keys
=
[];
if
(
data
.
selectionColumn
)
{
if
(
data
.
selectionColumn
)
{
$grid
.
find
(
"input[name='"
+
data
.
selectionColumn
+
"']:checked"
).
each
(
function
()
{
$grid
.
find
(
"input[name='"
+
data
.
selectionColumn
+
"']:checked"
).
each
(
function
()
{
...
@@ -118,8 +120,9 @@
...
@@ -118,8 +120,9 @@
});
});
},
},
data
:
function
()
{
data
:
function
()
{
return
this
.
data
(
'yiiGridView'
);
var
id
=
$
(
this
).
prop
(
'id'
);
return
gridData
[
id
];
}
}
};
};
})(
window
.
jQuery
);
})(
window
.
jQuery
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment