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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
197bf52a
Commit
197bf52a
authored
Jan 28, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a hidden link to support grid filtering.
parent
4433a67f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
35 deletions
+8
-35
yii.gridView.js
framework/assets/yii.gridView.js
+8
-35
No files found.
framework/assets/yii.gridView.js
View file @
197bf52a
...
...
@@ -36,7 +36,7 @@
});
var
enterPressed
=
false
;
$
(
document
).
on
(
'change.yiiGridView keydown.yiiGridView'
,
settings
.
filterSelector
,
function
(
event
)
{
$
(
settings
.
filterSelector
).
on
(
'change.yiiGridView keydown.yiiGridView'
,
function
(
event
)
{
if
(
event
.
type
===
'keydown'
)
{
if
(
event
.
keyCode
!==
13
)
{
return
;
// only react to enter key
...
...
@@ -57,7 +57,13 @@
}
else
{
url
+=
'?'
+
data
;
}
window
.
location
.
href
=
url
;
var
$filterLink
=
$
(
'.gridview-filter-link'
,
$e
);
if
(
!
$filterLink
.
length
)
{
$filterLink
=
$
(
'<a href="" style="display:none" class="gridview-filter-link"></a>'
);
$e
.
append
(
$filterLink
);
}
// use link clicking so that pjax can work by default
$filterLink
.
prop
(
'href'
,
url
).
click
();
return
false
;
});
});
...
...
@@ -102,38 +108,5 @@
return
this
.
data
(
'yiiGridView'
);
}
};
var
enterPressed
=
false
;
var
filterChanged
=
function
(
event
)
{
if
(
event
.
type
===
'keydown'
)
{
if
(
event
.
keyCode
!==
13
)
{
return
;
// only react to enter key
}
else
{
enterPressed
=
true
;
}
}
else
{
// prevent processing for both keydown and change events
if
(
enterPressed
)
{
enterPressed
=
false
;
return
;
}
}
var
data
=
$
(
settings
.
filterSelector
).
serialize
();
if
(
settings
.
pageVar
!==
undefined
)
{
data
+=
'&'
+
settings
.
pageVar
+
'=1'
;
}
if
(
settings
.
enableHistory
&&
settings
.
ajaxUpdate
!==
false
&&
window
.
History
.
enabled
)
{
// Ajaxify this link
var
url
=
$
(
'#'
+
id
).
yiiGridView
(
'getUrl'
),
params
=
$
.
deparam
.
querystring
(
$
.
param
.
querystring
(
url
,
data
));
delete
params
[
settings
.
ajaxVar
];
window
.
History
.
pushState
(
null
,
document
.
title
,
decodeURIComponent
(
$
.
param
.
querystring
(
url
.
substr
(
0
,
url
.
indexOf
(
'?'
)),
params
)));
}
else
{
$
(
'#'
+
id
).
yiiGridView
(
'update'
,
{
data
:
data
});
}
return
false
;
};
})(
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