Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
8561f5b9
Commit
8561f5b9
authored
May 28, 2012
by
Tristan Cavelier
Committed by
Sebastien Robin
Jun 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Slickgrid can now open document and sort list.
parent
219f5b28
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
13 deletions
+26
-13
OfficeJS/component/slickgrid_document_lister.html
OfficeJS/component/slickgrid_document_lister.html
+15
-7
OfficeJS/js/officejs.js
OfficeJS/js/officejs.js
+11
-6
No files found.
OfficeJS/component/slickgrid_document_lister.html
View file @
8561f5b9
<!DOCTYPE
HTML
>
<!DOCTYPE
html
>
<html>
<html>
<head>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=iso-8859-1"
>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=iso-8859-1"
>
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
<!--
<!--
(
function
()
{
(
function
()
{
var
grid
,
var
grid
,
onSortFunction
,
onClickFunction
,
documentlist
=
OfficeJS
.
cloneCurrentDocumentList
(),
columns
=
[
columns
=
[
{
id
:
"
fileName
"
,
name
:
"
Document
"
,
field
:
"
fileName
"
,
sortable
:
true
},
{
id
:
"
fileName
"
,
name
:
"
Document
"
,
field
:
"
fileName
"
,
sortable
:
true
},
{
id
:
"
lastModified
"
,
name
:
"
Modified
"
,
field
:
"
lastModified
"
,
sortable
:
true
},
{
id
:
"
lastModified
"
,
name
:
"
Modified
"
,
field
:
"
lastModified
"
,
sortable
:
true
},
...
@@ -39,16 +40,16 @@
...
@@ -39,16 +40,16 @@
$
(
function
()
{
$
(
function
()
{
grid
=
new
Slick
.
Grid
(
"
#myDocumentList
"
,
grid
=
new
Slick
.
Grid
(
"
#myDocumentList
"
,
OfficeJS
.
getCurrentDocumentList
()
,
documentlist
,
columns
,
columns
,
options
);
options
);
grid
.
onSort
.
subscribe
(
function
(
e
,
args
)
{
onSortFunction
=
function
(
e
,
args
)
{
var
cols
=
args
.
sortCols
;
var
cols
=
args
.
sortCols
;
OfficeJS
.
getCurrentDocumentList
()
.
documentlist
.
sort
(
function
(
dataRow1
,
dataRow2
)
{
sort
(
function
(
dataRow1
,
dataRow2
)
{
var
i
,
field
,
sign
,
value1
,
value2
,
result
;
var
i
,
l
,
field
,
sign
,
value1
,
value2
,
result
;
for
(
i
=
0
,
l
=
cols
.
length
;
i
<
l
;
i
++
)
{
for
(
i
=
0
,
l
=
cols
.
length
;
i
<
l
;
i
++
)
{
field
=
cols
[
i
].
sortCol
.
field
;
field
=
cols
[
i
].
sortCol
.
field
;
sign
=
cols
[
i
].
sortAsc
?
1
:
-
1
;
sign
=
cols
[
i
].
sortAsc
?
1
:
-
1
;
...
@@ -63,7 +64,14 @@
...
@@ -63,7 +64,14 @@
});
});
grid
.
invalidate
();
grid
.
invalidate
();
grid
.
render
();
grid
.
render
();
});
};
onClickFunction
=
function
(
e
)
{
var
cell
=
grid
.
getCellFromEvent
(
e
);
OfficeJS
.
open
({
app
:
'
textEditor
'
,
fileName
:
documentlist
[
cell
.
row
].
fileName
});
};
grid
.
onClick
.
subscribe
(
onClickFunction
);
grid
.
onSort
.
subscribe
(
onSortFunction
);
});
});
}());
}());
//-->
//-->
...
...
OfficeJS/js/officejs.js
View file @
8561f5b9
...
@@ -302,14 +302,19 @@
...
@@ -302,14 +302,19 @@
});
});
};
};
that
.
get
CurrentDocumentList
=
function
()
{
that
.
clone
CurrentDocumentList
=
function
()
{
// clone document list
// clone document list
var
array
=
$
.
extend
(
true
,[],
priv
.
data_object
.
documentList
),
i
;
var
array
=
$
.
extend
(
true
,[],
priv
.
data_object
.
documentList
),
i
,
lm
,
cd
;
for
(
i
=
0
;
i
<
array
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
array
.
length
;
i
+=
1
)
{
array
[
i
].
lastModified
=
(
new
Date
(
array
[
i
].
lastModified
)).
lm
=
(
new
Date
(
array
[
i
].
lastModified
));
toLocaleString
();
cd
=
(
new
Date
(
array
[
i
].
creationDate
));
array
[
i
].
creationDate
=
(
new
Date
(
array
[
i
].
creationDate
)).
array
[
i
].
lastModified
=
lm
.
getFullYear
()
+
'
/
'
+
toLocaleString
();
(
lm
.
getMonth
()
+
1
)
+
'
/
'
+
lm
.
getDate
()
+
'
'
+
lm
.
getHours
()
+
'
:
'
+
lm
.
getMinutes
();
array
[
i
].
creationDate
=
cd
.
getFullYear
()
+
'
/
'
+
(
cd
.
getMonth
()
+
1
)
+
'
/
'
+
cd
.
getDate
()
+
'
'
+
cd
.
getHours
()
+
'
:
'
+
cd
.
getMinutes
();
}
}
return
array
;
return
array
;
};
};
...
...
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