|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
|
| Hi, I have seen your reply for pagination wt following place. I'm looking to implement pagination for large dataset. Could you please send me the code if you have implemented it?? I'm very new to Dojo and would like to learn how to do the pagination. http://article.gmane.org/gmane.comp.web.dojo.user/40141 One more thing is that I'm not able to access example.Pagetable that's been given at http://www.dojotoolkit.org/2009/04/09/virtual-scrolling-grids-versus-paging-tables. Do u know how to open it?? it gives me "Not valid archive " error. Any help would be appreciated. Thanks, Shobitha |
Shobitha,_______________________________________________
No guarantees that this is the "correct" way since I've only been working with dojo for less than a year but it's working well for me and you're welcome to it. I'd like to keep the discussion on the forum in case someone else is interested in chiming in to make this better or correct my methodology. As I mentioned in the post you referenced, my data set is large and growing. My end user's browsers started having issues before I setup server side paging and my guess was data overload. Paging seemed to take care of the issue.
FYI . . . I'm using dojo in conjunction with ZendFramework so not everything is listed in this example and I'm cutting this example down for brevity.
My page is made up of a content pane with FilteringSelect to set the filter options for the grid (if any) and the grid. The server is set to return 10 items from the MySQL database at a time and a javascript object (rpcObj) keeps track of data page it's on. I'm not including any php or my rpc stuff here but basically the javascript function [sfilterGridPage(what)] resets the url for my dojo.data.ItemFileWriteStore and refreshes or creates the grid depending on if it's a new filter or updated.
Hopefully I didn't cut anything you might have needed out for paging but as you will notice a few of the grid cells are editable but I left out the JS and tried to remove a couple other functions to don't go with the example.
Hope this helps and I'd love anyone's feed back that has the time to browse this.
Rois Cannon
index.phtml
---------------------------------------------------------------------------------------------------------------------
<?php $this->dojo()->enable()
->requireModule("dojo.parser")
->requireModule("dijit.layout.BorderContainer")
->requireModule("dijit.layout.ContentPane")
->requireModule("dijit.form.Form")
->requireModule("dijit.form.FilteringSelect")
->requireModule("dijit.form.Button")
->requireModule("dojox.grid.DataGrid")
->addStylesheet("/js/dojo/dojox/grid/resources/Grid.css")
->addStylesheet("/js/dojo/dojox/grid/resources/nihiloGrid.css")
->requireModule("dojo.currency")
->requireModule("dojo.date.locale")
->requireModule("dojo.data.ItemFileWriteStore")
->requireModule("dojo.data.ItemFileReadStore"); ?>
<script type="text/javascript" src="/js/views/spec/index.js"></script>
<script>
<?php
// Setup Datastores for filterselects
foreach ($this->filter as $k=>$v) { ?>
var <?=$k ?>=<?=$v ?>;
var <?=$k.'Store' ?> = new dojo.data.ItemFileReadStore({data: <?=$k ?>});
<?php } ?>
dojo.addOnLoad(function() {
<?php
// Only filter grid now if it has already been filtered once.
if (is_array($this->returnfilter)) { ?>
sfilterGridPage('new');
<?php } ?>
});
</script>
<style>
#content { min-height: 90%; }
.hdrcell { float: left; text-align: center; }
.hdrcell font { font-weight: bold; color: blue; }
</style>
<div id="bordercontainer" jsId="bordercontainer" dojoType="dijit.layout.BorderContainer"
style="/*width: 800px; */ height: 375px; border: 1px solid #ccc;">
<div dojoType="dijit.layout.ContentPane" region="top">
<div class="hdrcell">
<font>SERIES</font><br />
<select id="series_id" jsId="series_id" dojoType="dijit.form.FilteringSelect"
store="seriesStore" searchAttr="label" value="<?=$this->returnfilter['series_id'] ?>"
style="width: 80px;"></select>
</div>
<div class="hdrcell">
<font>TYPE</font><br />
<select id="type_id" jsId="type_id" dojoType="dijit.form.FilteringSelect"
store="typeStore" searchAttr="label" value="<?=$this->returnfilter['type_id'] ?>"
style="width: 80px;"></select>
</div>
<div class="hdrcell">
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('new');">FilterNow</button>
</div>
<div class="hdrcell">
<button dojoType="dijit.form.Button" onclick="location.href='/Spec/edit';">Add New Blank</button>
</div>
</div>
<div dojoType="dijit.layout.ContentPane" region="center" id="ContentPaneCenter" name="ContentPaneCenter">
</div>
<div dojoType="dijit.layout.ContentPane" region="bottom">
<div id="navButtons" style="float: left;">
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('first');">First</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('prev');">Prev</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('next');">Next</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('last');">Last</button>
Page Number:<a id="pagenum" name="pagenum"></a> of <a id="pagecount" name="pagecount"></a>
</div>
</div>
</div>
---------------------------------------------------------------------------------------------------------------------
/js/views/spec/index.js
---------------------------------------------------------------------------------------------------------------------
// Data Grid layout
gridLayout = [{
defaultCell: { width: 4, styles: 'text-align: Right;',
editable: false },
rows: [
{ name: 'DESCR', field: 'key', width: 25, styles: 'text-align: Left;' },
{ name: '4/4', field: 'four', formatter: reformat },
{ name: '6/4', field: 'six', formatter: reformat },
{ name: 'VNR', field: 'veneer', formatter: reformat },
{ name: 'MDF', field: 'mdf', formatter: reformat },
{ name: 'PLY', field: 'ply', formatter: reformat },
{ name: 'MLoss', field: 'materialloss', formatter: reformat, editable: true },
{ name: 'Minutes', field: 'minutes', formatter: reformat, editable: true },
{ name: 'PrgLne', field: 'linenum', width: 6, styles: 'text-align: Left;' },
{ name: 'OptGrp', field: 'optiongroup', width: 7, styles: 'text-align: Left;' },
{ name: 'LChng', field: 'lastmodified', formatter: dateformat, styles: 'text-align: center;' },
{ name: 'series_id', field: 'series_id', hidden: true },
{ name: 'type_id', field: 'type_id', hidden: true },
{ name: 'models_id', field: 'models_id', hidden: true },
{ name: 'style_id', field: 'style_id', hidden: true },
{ name: 'height_id', field: 'height_id', hidden: true },
{ name: 'width_id', field: 'width_id', hidden: true },
{ name: 'pthickness_id', field: 'pthickness_id', hidden: true },
{ name: 'options_id', field: 'options_id', hidden: true }
]
}];
/*
Create and start the grid
*/
function newGrid() {
if(dojo.exists("grid")) {
grid._refresh();
} else {
var div = document.createElement('div');
div.id = 'grid';
div.name = 'grid';
grid = new dojox.grid.DataGrid({
jsid: 'grid',
store: specdata,
structure: gridLayout,
rowSelector: '0px'
}, div );
dojo.byId('ContentPaneCenter').appendChild(grid.domNode);
grid.startup();
dojo.connect(grid, "onApplyCellEdit", function(value, rindex, field) {
rpcObj.savespecprice(
dijit.byId('grid').store.getValue(dijit.byId('grid').getItem(rindex), 'modelspecs_id'), field, value, rindex
);
});
dojo.connect(grid, "onRowClick", function(e) {
if(e.cell.index==0) { editGrid(e); }
});
}
}
var specdata = new dojo.data.ItemFileWriteStore({ clearOnClose: true, urlPreventCache: true });
/*
server side grid filter with page number
what int pagenumber
itemcount: 0,
totalpages: 0,
perpage: 10,
pagenum: 1,
*/
function sfilterGridPage(what) {
var pull = 'false';
if ( what=='new' ) {
rpcObj.totalpages = 0;
rpcObj.pagenum=1;
pull = 'true';
}
if ( what=='first' && rpcObj.pagenum != 1) {
rpcObj.pagenum=1;
pull = 'true';
}
if ( what=='prev' && rpcObj.pagenum > 1 ) {
rpcObj.pagenum-=1;
pull = 'true';
}
if ( what=='next' && ( rpcObj.pagenum <= rpcObj.totalpages-1 )) {
rpcObj.pagenum+=1;
pull = 'true';
}
if ( what=='last' && rpcObj.pagenum != rpcObj.totalpages ) {
rpcObj.pagenum = rpcObj.totalpages;
pull = 'true';
}
if(pull=='true') {
specdata.close();
var filterby = {
series_id: dijit.byId('series_id').value,
type_id: dijit.byId('type_id').value
};
var url = "/spec/records/pagenum/"+rpcObj.pagenum+"/filterby/" + dojo.toJson(filterby);
specdata._jsonFileUrl = url;
specdata.fetch({
onComplete: function() {
newGrid();
standby.hide();
dojo.byId('pagenum').innerHTML = rpcObj.pagenum;
if (rpcObj.totalpages==0) {
rpcObj.countfilteredset();
}
}
});
}
}
---------------------------------------------------------------------------------------------------------------------
-----Original Message-----
From: shobitha nellutla <shobitha%20nellutla%20%3cnshobi_82@...>
To: rois@...
Subject: Hi
Date: Mon, 9 Nov 2009 18:18:22 +0530 (IST)
Hi, I have seen your reply for pagination wt following place. I'm looking to implement pagination for large dataset. Could you please send me the code if you have implemented it?? I'm very new to Dojo and would like to learn how to do the pagination. http://article.gmane.org/gmane.comp.web.dojo.user/40141 One more thing is that I'm not able to access example.Pagetable that's been given at http://www.dojotoolkit.org/2009/04/09/virtual-scrolling-grids-versus-paging-tables. Do u know how to open it?? it gives me "Not valid archive " error. Any help would be appreciated. Thanks, Shobitha
Now, send attachments up to 25MB with Yahoo! India Mail. Learn how.
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
|
|
Shobitha,
No guarantees that this is the "correct" way since I've only been working with dojo for less than a year but it's working well for me and you're welcome to it. I'd like to keep the discussion on the forum in case someone else is interested in chiming in to make this better or correct my methodology. As I mentioned in the post you referenced, my data set is large and growing. My end user's browsers started having issues before I setup server side paging and my guess was data overload. Paging seemed to take care of the issue.
FYI . . . I'm using dojo in conjunction with ZendFramework so not everything is listed in this example and I'm cutting this example down for brevity.
My page is made up of a content pane with FilteringSelect to set the filter options for the grid (if any) and the grid. The server is set to return 10 items from the MySQL database at a time and a javascript object (rpcObj) keeps track of data page it's on. I'm not including any php or my rpc stuff here but basically the javascript function [sfilterGridPage(what)] resets the url for my dojo.data.ItemFileWriteStore and refreshes or creates the grid depending on if it's a new filter or updated.
Hopefully I didn't cut anything you might have needed out for paging but as you will notice a few of the grid cells are editable but I left out the JS and tried to remove a couple other functions to don't go with the example.
Hope this helps and I'd love anyone's feed back that has the time to browse this.
Rois Cannon
index.phtml
---------------------------------------------------------------------------------------------------------------------
<?php $this->dojo()->enable()
->requireModule("dojo.parser")
->requireModule("dijit.layout.BorderContainer")
->requireModule("dijit.layout.ContentPane")
->requireModule("dijit.form.Form")
->requireModule("dijit.form.FilteringSelect")
->requireModule("dijit.form.Button")
->requireModule("dojox.grid.DataGrid")
->addStylesheet("/js/dojo/dojox/grid/resources/Grid.css")
->addStylesheet("/js/dojo/dojox/grid/resources/nihiloGrid.css")
->requireModule("dojo.currency")
->requireModule("dojo.date.locale")
->requireModule("dojo.data.ItemFileWriteStore")
->requireModule("dojo.data.ItemFileReadStore"); ?>
<script type="text/javascript" src="/js/views/spec/index.js"></script>
<script>
<?php
// Setup Datastores for filterselects
foreach ($this->filter as $k=>$v) { ?>
var <?=$k ?>=<?=$v ?>;
var <?=$k.'Store' ?> = new dojo.data.ItemFileReadStore({data: <?=$k ?>});
<?php } ?>
dojo.addOnLoad(function() {
<?php
// Only filter grid now if it has already been filtered once.
if (is_array($this->returnfilter)) { ?>
sfilterGridPage('new');
<?php } ?>
});
</script>
<style>
#content { min-height: 90%; }
.hdrcell { float: left; text-align: center; }
.hdrcell font { font-weight: bold; color: blue; }
</style>
<div id="bordercontainer" jsId="bordercontainer" dojoType="dijit.layout.BorderContainer"
style="/*width: 800px; */ height: 375px; border: 1px solid #ccc;">
<div dojoType="dijit.layout.ContentPane" region="top">
<div class="hdrcell">
<font>SERIES</font><br />
<select id="series_id" jsId="series_id" dojoType="dijit.form.FilteringSelect"
store="seriesStore" searchAttr="label" value="<?=$this->returnfilter['series_id'] ?>"
style="width: 80px;"></select>
</div>
<div class="hdrcell">
<font>TYPE</font><br />
<select id="type_id" jsId="type_id" dojoType="dijit.form.FilteringSelect"
store="typeStore" searchAttr="label" value="<?=$this->returnfilter['type_id'] ?>"
style="width: 80px;"></select>
</div>
<div class="hdrcell">
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('new');">FilterNow</button>
</div>
<div class="hdrcell">
<button dojoType="dijit.form.Button" onclick="location.href='/Spec/edit';">Add New Blank</button>
</div>
</div>
<div dojoType="dijit.layout.ContentPane" region="center" id="ContentPaneCenter" name="ContentPaneCenter">
</div>
<div dojoType="dijit.layout.ContentPane" region="bottom">
<div id="navButtons" style="float: left;">
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('first');">First</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('prev');">Prev</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('next');">Next</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('last');">Last</button>
Page Number:<a id="pagenum" name="pagenum"></a> of <a id="pagecount" name="pagecount"></a>
</div>
</div>
</div>
---------------------------------------------------------------------------------------------------------------------
/js/views/spec/index.js
---------------------------------------------------------------------------------------------------------------------
// Data Grid layout
gridLayout = [{
defaultCell: { width: 4, styles: 'text-align: Right;',
editable: false },
rows: [
{ name: 'DESCR', field: 'key', width: 25, styles: 'text-align: Left;' },
{ name: '4/4', field: 'four', formatter: reformat },
{ name: '6/4', field: 'six', formatter: reformat },
{ name: 'VNR', field: 'veneer', formatter: reformat },
{ name: 'MDF', field: 'mdf', formatter: reformat },
{ name: 'PLY', field: 'ply', formatter: reformat },
{ name: 'MLoss', field: 'materialloss', formatter: reformat, editable: true },
{ name: 'Minutes', field: 'minutes', formatter: reformat, editable: true },
{ name: 'PrgLne', field: 'linenum', width: 6, styles: 'text-align: Left;' },
{ name: 'OptGrp', field: 'optiongroup', width: 7, styles: 'text-align: Left;' },
{ name: 'LChng', field: 'lastmodified', formatter: dateformat, styles: 'text-align: center;' },
{ name: 'series_id', field: 'series_id', hidden: true },
{ name: 'type_id', field: 'type_id', hidden: true },
{ name: 'models_id', field: 'models_id', hidden: true },
{ name: 'style_id', field: 'style_id', hidden: true },
{ name: 'height_id', field: 'height_id', hidden: true },
{ name: 'width_id', field: 'width_id', hidden: true },
{ name: 'pthickness_id', field: 'pthickness_id', hidden: true },
{ name: 'options_id', field: 'options_id', hidden: true }
]
}];
/*
Create and start the grid
*/
function newGrid() {
if(dojo.exists("grid")) {
grid._refresh();
} else {
var div = document.createElement('div');
div.id = 'grid';
div.name = 'grid';
grid = new dojox.grid.DataGrid({
jsid: 'grid',
store: specdata,
structure: gridLayout,
rowSelector: '0px'
}, div );
dojo.byId('ContentPaneCenter').appendChild(grid.domNode);
grid.startup();
dojo.connect(grid, "onApplyCellEdit", function(value, rindex, field) {
rpcObj.savespecprice(
dijit.byId('grid').store.getValue(dijit.byId('grid').getItem(rindex), 'modelspecs_id'), field, value, rindex
);
});
dojo.connect(grid, "onRowClick", function(e) {
if(e.cell.index==0) { editGrid(e); }
});
}
}
var specdata = new dojo.data.ItemFileWriteStore({ clearOnClose: true, urlPreventCache: true });
/*
server side grid filter with page number
what int pagenumber
itemcount: 0,
totalpages: 0,
perpage: 10,
pagenum: 1,
*/
function sfilterGridPage(what) {
var pull = 'false';
if ( what=='new' ) {
rpcObj.totalpages = 0;
rpcObj.pagenum=1;
pull = 'true';
}
if ( what=='first' && rpcObj.pagenum != 1) {
rpcObj.pagenum=1;
pull = 'true';
}
if ( what=='prev' && rpcObj.pagenum > 1 ) {
rpcObj.pagenum-=1;
pull = 'true';
}
if ( what=='next' && ( rpcObj.pagenum <= rpcObj.totalpages-1 )) {
rpcObj.pagenum+=1;
pull = 'true';
}
if ( what=='last' && rpcObj.pagenum != rpcObj.totalpages ) {
rpcObj.pagenum = rpcObj.totalpages;
pull = 'true';
}
if(pull=='true') {
specdata.close();
var filterby = {
series_id: dijit.byId('series_id').value,
type_id: dijit.byId('type_id').value
};
var url = "/spec/records/pagenum/"+rpcObj.pagenum+"/filterby/" + dojo.toJson(filterby);
specdata._jsonFileUrl = url;
specdata.fetch({
onComplete: function() {
newGrid();
standby.hide();
dojo.byId('pagenum').innerHTML = rpcObj.pagenum;
if (rpcObj.totalpages==0) {
rpcObj.countfilteredset();
}
}
});
}
}
---------------------------------------------------------------------------------------------------------------------
-----Original Message-----
From: shobitha nellutla <shobitha%20nellutla%20%3cnshobi_82@...>
To: rois@...
Subject: Hi
Date: Mon, 9 Nov 2009 18:18:22 +0530 (IST)
Hi, I have seen your reply for pagination wt following place. I'm looking to implement pagination for large dataset. Could you please send me the code if you have implemented it?? I'm very new to Dojo and would like to learn how to do the pagination. http://article.gmane.org/gmane.comp.web.dojo.user/40141 One more thing is that I'm not able to access example.Pagetable that's been given at http://www.dojotoolkit.org/2009/04/09/virtual-scrolling-grids-versus-paging-tables. Do u know how to open it?? it gives me "Not valid archive " error. Any help would be appreciated. Thanks, Shobitha
Now, send attachments up to 25MB with Yahoo! India Mail. Learn how.
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
_______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Looks cool. Can you or anyone tell me just how much data a datastore can hold? I'm assuming it depends on how much memory the client machine has. Will the paging function know how to dump info to keep the memory foot print reasonable or at least at a size set the developer thinks is reasonable? I have data in my store that isn't shown on the grid but is used in related JS functions. Originally I was just pulling data into the datastore and then sorting and filtering from there but after my end users reached the 500 or 600 record mark the browsers started having issues. At that point I changed to server side paging and filtering. That seemed to take care of the issue (client now has over 2K records and still growing) but I'm always looking for a better/faster/simpler way of doing things?_______________________________________________
Thank you
Rois Cannon
-----Original Message-----
From: Nathan Toone <Nathan%20Toone%20%3ctoonetown@...>
Reply-To: dojo-interest@...
To: dojo-interest@...
Cc: shobitha nellutla <shobitha%20nellutla%20%3cnshobi_82@...>
Subject: Re: [Dojo-interest] grid and pagination
Date: Mon, 9 Nov 2009 10:32:57 -0700
Along these lines, there is a trac ticket logged at http://bugs.dojotoolkit.org/ticket/9128. I have an experimental patch that adds "real" paging to the grid. I am working on cleaning it up and will post to that bug...hopefully in the next 2-3 weeks (after 1.4 ships).
-Nathan
On Nov 9, 2009, at 10:23 AM, Rois Cannon wrote:
Shobitha,
No guarantees that this is the "correct" way since I've only been working with dojo for less than a year but it's working well for me and you're welcome to it. I'd like to keep the discussion on the forum in case someone else is interested in chiming in to make this better or correct my methodology. As I mentioned in the post you referenced, my data set is large and growing. My end user's browsers started having issues before I setup server side paging and my guess was data overload. Paging seemed to take care of the issue.
FYI . . . I'm using dojo in conjunction with ZendFramework so not everything is listed in this example and I'm cutting this example down for brevity.
My page is made up of a content pane with FilteringSelect to set the filter options for the grid (if any) and the grid. The server is set to return 10 items from the MySQL database at a time and a javascript object (rpcObj) keeps track of data page it's on. I'm not including any php or my rpc stuff here but basically the javascript function [sfilterGridPage(what)] resets the url for my dojo.data.ItemFileWriteStore and refreshes or creates the grid depending on if it's a new filter or updated.
Hopefully I didn't cut anything you might have needed out for paging but as you will notice a few of the grid cells are editable but I left out the JS and tried to remove a couple other functions to don't go with the example.
Hope this helps and I'd love anyone's feed back that has the time to browse this.
Rois Cannon
index.phtml
---------------------------------------------------------------------------------------------------------------------
<?php $this->dojo()->enable()
->requireModule("dojo.parser")
->requireModule("dijit.layout.BorderContainer")
->requireModule("dijit.layout.ContentPane")
->requireModule("dijit.form.Form")
->requireModule("dijit.form.FilteringSelect")
->requireModule("dijit.form.Button")
->requireModule("dojox.grid.DataGrid")
->addStylesheet("/js/dojo/dojox/grid/resources/Grid.css")
->addStylesheet("/js/dojo/dojox/grid/resources/nihiloGrid.css")
->requireModule("dojo.currency")
->requireModule("dojo.date.locale")
->requireModule("dojo.data.ItemFileWriteStore")
->requireModule("dojo.data.ItemFileReadStore"); ?>
<script type="text/javascript" src="/js/views/spec/index.js"></script>
<script>
<?php
// Setup Datastores for filterselects
foreach ($this->filter as $k=>$v) { ?>
var <?=$k ?>=<?=$v ?>;
var <?=$k.'Store' ?> = new dojo.data.ItemFileReadStore({data: <?=$k ?>});
<?php } ?>
dojo.addOnLoad(function() {
<?php
// Only filter grid now if it has already been filtered once.
if (is_array($this->returnfilter)) { ?>
sfilterGridPage('new');
<?php } ?>
});
</script>
<style>
#content { min-height: 90%; }
.hdrcell { float: left; text-align: center; }
.hdrcell font { font-weight: bold; color: blue; }
</style>
<div id="bordercontainer" jsId="bordercontainer" dojoType="dijit.layout.BorderContainer"
style="/*width: 800px; */ height: 375px; border: 1px solid #ccc;">
<div dojoType="dijit.layout.ContentPane" region="top">
<div class="hdrcell">
<font>SERIES</font><br />
<select id="series_id" jsId="series_id" dojoType="dijit.form.FilteringSelect"
store="seriesStore" searchAttr="label" value="<?=$this->returnfilter['series_id'] ?>"
style="width: 80px;"></select>
</div>
<div class="hdrcell">
<font>TYPE</font><br />
<select id="type_id" jsId="type_id" dojoType="dijit.form.FilteringSelect"
store="typeStore" searchAttr="label" value="<?=$this->returnfilter['type_id'] ?>"
style="width: 80px;"></select>
</div>
<div class="hdrcell">
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('new');">FilterNow</button>
</div>
<div class="hdrcell">
<button dojoType="dijit.form.Button" onclick="location.href='/Spec/edit';">Add New Blank</button>
</div>
</div>
<div dojoType="dijit.layout.ContentPane" region="center" id="ContentPaneCenter" name="ContentPaneCenter">
</div>
<div dojoType="dijit.layout.ContentPane" region="bottom">
<div id="navButtons" style="float: left;">
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('first');">First</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('prev');">Prev</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('next');">Next</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('last');">Last</button>
Page Number:<a id="pagenum" name="pagenum"></a> of <a id="pagecount" name="pagecount"></a>
</div>
</div>
</div>
---------------------------------------------------------------------------------------------------------------------
/js/views/spec/index.js
---------------------------------------------------------------------------------------------------------------------
// Data Grid layout
gridLayout = [{
defaultCell: { width: 4, styles: 'text-align: Right;',
editable: false },
rows: [
{ name: 'DESCR', field: 'key', width: 25, styles: 'text-align: Left;' },
{ name: '4/4', field: 'four', formatter: reformat },
{ name: '6/4', field: 'six', formatter: reformat },
{ name: 'VNR', field: 'veneer', formatter: reformat },
{ name: 'MDF', field: 'mdf', formatter: reformat },
{ name: 'PLY', field: 'ply', formatter: reformat },
{ name: 'MLoss', field: 'materialloss', formatter: reformat, editable: true },
{ name: 'Minutes', field: 'minutes', formatter: reformat, editable: true },
{ name: 'PrgLne', field: 'linenum', width: 6, styles: 'text-align: Left;' },
{ name: 'OptGrp', field: 'optiongroup', width: 7, styles: 'text-align: Left;' },
{ name: 'LChng', field: 'lastmodified', formatter: dateformat, styles: 'text-align: center;' },
{ name: 'series_id', field: 'series_id', hidden: true },
{ name: 'type_id', field: 'type_id', hidden: true },
{ name: 'models_id', field: 'models_id', hidden: true },
{ name: 'style_id', field: 'style_id', hidden: true },
{ name: 'height_id', field: 'height_id', hidden: true },
{ name: 'width_id', field: 'width_id', hidden: true },
{ name: 'pthickness_id', field: 'pthickness_id', hidden: true },
{ name: 'options_id', field: 'options_id', hidden: true }
]
}];
/*
Create and start the grid
*/
function newGrid() {
if(dojo.exists("grid")) {
grid._refresh();
} else {
var div = document.createElement('div');
div.id = 'grid';
div.name = 'grid';
grid = new dojox.grid.DataGrid({
jsid: 'grid',
store: specdata,
structure: gridLayout,
rowSelector: '0px'
}, div );
dojo.byId('ContentPaneCenter').appendChild(grid.domNode);
grid.startup();
dojo.connect(grid, "onApplyCellEdit", function(value, rindex, field) {
rpcObj.savespecprice(
dijit.byId('grid').store.getValue(dijit.byId('grid').getItem(rindex), 'modelspecs_id'), field, value, rindex
);
});
dojo.connect(grid, "onRowClick", function(e) {
if(e.cell.index==0) { editGrid(e); }
});
}
}
var specdata = new dojo.data.ItemFileWriteStore({ clearOnClose: true, urlPreventCache: true });
/*
server side grid filter with page number
what int pagenumber
itemcount: 0,
totalpages: 0,
perpage: 10,
pagenum: 1,
*/
function sfilterGridPage(what) {
var pull = 'false';
if ( what=='new' ) {
rpcObj.totalpages = 0;
rpcObj.pagenum=1;
pull = 'true';
}
if ( what=='first' && rpcObj.pagenum != 1) {
rpcObj.pagenum=1;
pull = 'true';
}
if ( what=='prev' && rpcObj.pagenum > 1 ) {
rpcObj.pagenum-=1;
pull = 'true';
}
if ( what=='next' && ( rpcObj.pagenum <= rpcObj.totalpages-1 )) {
rpcObj.pagenum+=1;
pull = 'true';
}
if ( what=='last' && rpcObj.pagenum != rpcObj.totalpages ) {
rpcObj.pagenum = rpcObj.totalpages;
pull = 'true';
}
if(pull=='true') {
specdata.close();
var filterby = {
series_id: dijit.byId('series_id').value,
type_id: dijit.byId('type_id').value
};
var url = "/spec/records/pagenum/"+rpcObj.pagenum+"/filterby/" + dojo.toJson(filterby);
specdata._jsonFileUrl = url;
specdata.fetch({
onComplete: function() {
newGrid();
standby.hide();
dojo.byId('pagenum').innerHTML = rpcObj.pagenum;
if (rpcObj.totalpages==0) {
rpcObj.countfilteredset();
}
}
});
}
}
---------------------------------------------------------------------------------------------------------------------
-----Original Message-----
From: shobitha nellutla <shobitha%20nellutla%20%3cnshobi_82@...>
To: rois@...
Subject: Hi
Date: Mon, 9 Nov 2009 18:18:22 +0530 (IST)
Hi, I have seen your reply for pagination wt following place. I'm looking to implement pagination for large dataset. Could you please send me the code if you have implemented it?? I'm very new to Dojo and would like to learn how to do the pagination. http://article.gmane.org/gmane.comp.web.dojo.user/40141 One more thing is that I'm not able to access example.Pagetable that's been given at http://www.dojotoolkit.org/2009/04/09/virtual-scrolling-grids-versus-paging-tables. Do u know how to open it?? it gives me "Not valid archive " error. Any help would be appreciated. Thanks, Shobitha
Now, send attachments up to 25MB with Yahoo! India Mail. Learn how._______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
_______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Looks cool. Can you or anyone tell me just how much data a datastore can hold? I'm assuming it depends on how much memory the client machine has. Will the paging function know how to dump info to keep the memory foot print reasonable or at least at a size set the developer thinks is reasonable? I have data in my store that isn't shown on the grid but is used in related JS functions. Originally I was just pulling data into the datastore and then sorting and filtering from there but after my end users reached the 500 or 600 record mark the browsers started having issues. At that point I changed to server side paging and filtering. That seemed to take care of the issue (client now has over 2K records and still growing) but I'm always looking for a better/faster/simpler way of doing things?
Thank you
Rois Cannon
-----Original Message-----
From: Nathan Toone <Nathan%20Toone%20%3ctoonetown@...>
Reply-To: dojo-interest@...
To: dojo-interest@...
Cc: shobitha nellutla <shobitha%20nellutla%20%3cnshobi_82@...>
Subject: Re: [Dojo-interest] grid and pagination
Date: Mon, 9 Nov 2009 10:32:57 -0700
Along these lines, there is a trac ticket logged at http://bugs.dojotoolkit.org/ticket/9128. I have an experimental patch that adds "real" paging to the grid. I am working on cleaning it up and will post to that bug...hopefully in the next 2-3 weeks (after 1.4 ships).
-Nathan
On Nov 9, 2009, at 10:23 AM, Rois Cannon wrote:
Shobitha,
No guarantees that this is the "correct" way since I've only been working with dojo for less than a year but it's working well for me and you're welcome to it. I'd like to keep the discussion on the forum in case someone else is interested in chiming in to make this better or correct my methodology. As I mentioned in the post you referenced, my data set is large and growing. My end user's browsers started having issues before I setup server side paging and my guess was data overload. Paging seemed to take care of the issue.
FYI . . . I'm using dojo in conjunction with ZendFramework so not everything is listed in this example and I'm cutting this example down for brevity.
My page is made up of a content pane with FilteringSelect to set the filter options for the grid (if any) and the grid. The server is set to return 10 items from the MySQL database at a time and a javascript object (rpcObj) keeps track of data page it's on. I'm not including any php or my rpc stuff here but basically the javascript function [sfilterGridPage(what)] resets the url for my dojo.data.ItemFileWriteStore and refreshes or creates the grid depending on if it's a new filter or updated.
Hopefully I didn't cut anything you might have needed out for paging but as you will notice a few of the grid cells are editable but I left out the JS and tried to remove a couple other functions to don't go with the example.
Hope this helps and I'd love anyone's feed back that has the time to browse this.
Rois Cannon
index.phtml
---------------------------------------------------------------------------------------------------------------------
<?php $this->dojo()->enable()
->requireModule("dojo.parser")
->requireModule("dijit.layout.BorderContainer")
->requireModule("dijit.layout.ContentPane")
->requireModule("dijit.form.Form")
->requireModule("dijit.form.FilteringSelect")
->requireModule("dijit.form.Button")
->requireModule("dojox.grid.DataGrid")
->addStylesheet("/js/dojo/dojox/grid/resources/Grid.css")
->addStylesheet("/js/dojo/dojox/grid/resources/nihiloGrid.css")
->requireModule("dojo.currency")
->requireModule("dojo.date.locale")
->requireModule("dojo.data.ItemFileWriteStore")
->requireModule("dojo.data.ItemFileReadStore"); ?>
<script type="text/javascript" src="/js/views/spec/index.js"></script>
<script>
<?php
// Setup Datastores for filterselects
foreach ($this->filter as $k=>$v) { ?>
var <?=$k ?>=<?=$v ?>;
var <?=$k.'Store' ?> = new dojo.data.ItemFileReadStore({data: <?=$k ?>});
<?php } ?>
dojo.addOnLoad(function() {
<?php
// Only filter grid now if it has already been filtered once.
if (is_array($this->returnfilter)) { ?>
sfilterGridPage('new');
<?php } ?>
});
</script>
<style>
#content { min-height: 90%; }
.hdrcell { float: left; text-align: center; }
.hdrcell font { font-weight: bold; color: blue; }
</style>
<div id="bordercontainer" jsId="bordercontainer" dojoType="dijit.layout.BorderContainer"
style="/*width: 800px; */ height: 375px; border: 1px solid #ccc;">
<div dojoType="dijit.layout.ContentPane" region="top">
<div class="hdrcell">
<font>SERIES</font><br />
<select id="series_id" jsId="series_id" dojoType="dijit.form.FilteringSelect"
store="seriesStore" searchAttr="label" value="<?=$this->returnfilter['series_id'] ?>"
style="width: 80px;"></select>
</div>
<div class="hdrcell">
<font>TYPE</font><br />
<select id="type_id" jsId="type_id" dojoType="dijit.form.FilteringSelect"
store="typeStore" searchAttr="label" value="<?=$this->returnfilter['type_id'] ?>"
style="width: 80px;"></select>
</div>
<div class="hdrcell">
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('new');">FilterNow</button>
</div>
<div class="hdrcell">
<button dojoType="dijit.form.Button" onclick="location.href='/Spec/edit';">Add New Blank</button>
</div>
</div>
<div dojoType="dijit.layout.ContentPane" region="center" id="ContentPaneCenter" name="ContentPaneCenter">
</div>
<div dojoType="dijit.layout.ContentPane" region="bottom">
<div id="navButtons" style="float: left;">
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('first');">First</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('prev');">Prev</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('next');">Next</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('last');">Last</button>
Page Number:<a id="pagenum" name="pagenum"></a> of <a id="pagecount" name="pagecount"></a>
</div>
</div>
</div>
---------------------------------------------------------------------------------------------------------------------
/js/views/spec/index.js
---------------------------------------------------------------------------------------------------------------------
// Data Grid layout
gridLayout = [{
defaultCell: { width: 4, styles: 'text-align: Right;',
editable: false },
rows: [
{ name: 'DESCR', field: 'key', width: 25, styles: 'text-align: Left;' },
{ name: '4/4', field: 'four', formatter: reformat },
{ name: '6/4', field: 'six', formatter: reformat },
{ name: 'VNR', field: 'veneer', formatter: reformat },
{ name: 'MDF', field: 'mdf', formatter: reformat },
{ name: 'PLY', field: 'ply', formatter: reformat },
{ name: 'MLoss', field: 'materialloss', formatter: reformat, editable: true },
{ name: 'Minutes', field: 'minutes', formatter: reformat, editable: true },
{ name: 'PrgLne', field: 'linenum', width: 6, styles: 'text-align: Left;' },
{ name: 'OptGrp', field: 'optiongroup', width: 7, styles: 'text-align: Left;' },
{ name: 'LChng', field: 'lastmodified', formatter: dateformat, styles: 'text-align: center;' },
{ name: 'series_id', field: 'series_id', hidden: true },
{ name: 'type_id', field: 'type_id', hidden: true },
{ name: 'models_id', field: 'models_id', hidden: true },
{ name: 'style_id', field: 'style_id', hidden: true },
{ name: 'height_id', field: 'height_id', hidden: true },
{ name: 'width_id', field: 'width_id', hidden: true },
{ name: 'pthickness_id', field: 'pthickness_id', hidden: true },
{ name: 'options_id', field: 'options_id', hidden: true }
]
}];
/*
Create and start the grid
*/
function newGrid() {
if(dojo.exists("grid")) {
grid._refresh();
} else {
var div = document.createElement('div');
div.id = 'grid';
div.name = 'grid';
grid = new dojox.grid.DataGrid({
jsid: 'grid',
store: specdata,
structure: gridLayout,
rowSelector: '0px'
}, div );
dojo.byId('ContentPaneCenter').appendChild(grid.domNode);
grid.startup();
dojo.connect(grid, "onApplyCellEdit", function(value, rindex, field) {
rpcObj.savespecprice(
dijit.byId('grid').store.getValue(dijit.byId('grid').getItem(rindex), 'modelspecs_id'), field, value, rindex
);
});
dojo.connect(grid, "onRowClick", function(e) {
if(e.cell.index==0) { editGrid(e); }
});
}
}
var specdata = new dojo.data.ItemFileWriteStore({ clearOnClose: true, urlPreventCache: true });
/*
server side grid filter with page number
what int pagenumber
itemcount: 0,
totalpages: 0,
perpage: 10,
pagenum: 1,
*/
function sfilterGridPage(what) {
var pull = 'false';
if ( what=='new' ) {
rpcObj.totalpages = 0;
rpcObj.pagenum=1;
pull = 'true';
}
if ( what=='first' && rpcObj.pagenum != 1) {
rpcObj.pagenum=1;
pull = 'true';
}
if ( what=='prev' && rpcObj.pagenum > 1 ) {
rpcObj.pagenum-=1;
pull = 'true';
}
if ( what=='next' && ( rpcObj.pagenum <= rpcObj.totalpages-1 )) {
rpcObj.pagenum+=1;
pull = 'true';
}
if ( what=='last' && rpcObj.pagenum != rpcObj.totalpages ) {
rpcObj.pagenum = rpcObj.totalpages;
pull = 'true';
}
if(pull=='true') {
specdata.close();
var filterby = {
series_id: dijit.byId('series_id').value,
type_id: dijit.byId('type_id').value
};
var url = "/spec/records/pagenum/"+rpcObj.pagenum+"/filterby/" + dojo.toJson(filterby);
specdata._jsonFileUrl = url;
specdata.fetch({
onComplete: function() {
newGrid();
standby.hide();
dojo.byId('pagenum').innerHTML = rpcObj.pagenum;
if (rpcObj.totalpages==0) {
rpcObj.countfilteredset();
}
}
});
}
}
---------------------------------------------------------------------------------------------------------------------
-----Original Message-----
From: shobitha nellutla <shobitha%20nellutla%20%3cnshobi_82@...>
To: rois@...
Subject: Hi
Date: Mon, 9 Nov 2009 18:18:22 +0530 (IST)
Hi, I have seen your reply for pagination wt following place. I'm looking to implement pagination for large dataset. Could you please send me the code if you have implemented it?? I'm very new to Dojo and would like to learn how to do the pagination. http://article.gmane.org/gmane.comp.web.dojo.user/40141 One more thing is that I'm not able to access example.Pagetable that's been given at http://www.dojotoolkit.org/2009/04/09/virtual-scrolling-grids-versus-paging-tables. Do u know how to open it?? it gives me "Not valid archive " error. Any help would be appreciated. Thanks, Shobitha
Now, send attachments up to 25MB with Yahoo! India Mail. Learn how.
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
_______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
_______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Maybe I should be using QueryReadStore but can I attach that to a grid and still use onApplyCellEdit in the grid? I thought I had to use ItemFileWriteStore if I wanted editable cells in my grid._______________________________________________
Thoughts?
Rois
-----Original Message-----
From: Nathan Toone <Nathan%20Toone%20%3ctoonetown@...>
Reply-To: dojo-interest@...
To: dojo-interest@...
Subject: Re: [Dojo-interest] grid and pagination
Date: Mon, 9 Nov 2009 13:07:37 -0700
Depends on the datastore. If you do server-side paging (like the dojox.data.QueryReadStore), then only the info that has been displayed will be passed down to the client...so there really is no limit.
Some widgets, like the grid, will even swap out pages once they are no longer used....that is, after a while, the grid will start cleaning up pages, even if they've been downloaded.
Our application handles millions of entries via a custom datastore that is handled server-side - and we haven't had any issues with it.
Client-side stores, however, like dojo.data.ItemFileReadStore, will NOT handle near as much data...since it is all handled and processed client-side.
-Nathan
On Nov 9, 2009, at 1:01 PM, Rois Cannon wrote:
Looks cool. Can you or anyone tell me just how much data a datastore can hold? I'm assuming it depends on how much memory the client machine has. Will the paging function know how to dump info to keep the memory foot print reasonable or at least at a size set the developer thinks is reasonable? I have data in my store that isn't shown on the grid but is used in related JS functions. Originally I was just pulling data into the datastore and then sorting and filtering from there but after my end users reached the 500 or 600 record mark the browsers started having issues. At that point I changed to server side paging and filtering. That seemed to take care of the issue (client now has over 2K records and still growing) but I'm always looking for a better/faster/simpler way of doing things?
Thank you
Rois Cannon
-----Original Message-----
From: Nathan Toone <Nathan%20Toone%20%3ctoonetown@...>
Reply-To: dojo-interest@...
To: dojo-interest@...
Cc: shobitha nellutla <shobitha%20nellutla%20%3cnshobi_82@...>
Subject: Re: [Dojo-interest] grid and pagination
Date: Mon, 9 Nov 2009 10:32:57 -0700
Along these lines, there is a trac ticket logged at http://bugs.dojotoolkit.org/ticket/9128. I have an experimental patch that adds "real" paging to the grid. I am working on cleaning it up and will post to that bug...hopefully in the next 2-3 weeks (after 1.4 ships).
-Nathan
On Nov 9, 2009, at 10:23 AM, Rois Cannon wrote:
Shobitha,
No guarantees that this is the "correct" way since I've only been working with dojo for less than a year but it's working well for me and you're welcome to it. I'd like to keep the discussion on the forum in case someone else is interested in chiming in to make this better or correct my methodology. As I mentioned in the post you referenced, my data set is large and growing. My end user's browsers started having issues before I setup server side paging and my guess was data overload. Paging seemed to take care of the issue.
FYI . . . I'm using dojo in conjunction with ZendFramework so not everything is listed in this example and I'm cutting this example down for brevity.
My page is made up of a content pane with FilteringSelect to set the filter options for the grid (if any) and the grid. The server is set to return 10 items from the MySQL database at a time and a javascript object (rpcObj) keeps track of data page it's on. I'm not including any php or my rpc stuff here but basically the javascript function [sfilterGridPage(what)] resets the url for my dojo.data.ItemFileWriteStore and refreshes or creates the grid depending on if it's a new filter or updated.
Hopefully I didn't cut anything you might have needed out for paging but as you will notice a few of the grid cells are editable but I left out the JS and tried to remove a couple other functions to don't go with the example.
Hope this helps and I'd love anyone's feed back that has the time to browse this.
Rois Cannon
index.phtml
---------------------------------------------------------------------------------------------------------------------
<?php $this->dojo()->enable()
->requireModule("dojo.parser")
->requireModule("dijit.layout.BorderContainer")
->requireModule("dijit.layout.ContentPane")
->requireModule("dijit.form.Form")
->requireModule("dijit.form.FilteringSelect")
->requireModule("dijit.form.Button")
->requireModule("dojox.grid.DataGrid")
->addStylesheet("/js/dojo/dojox/grid/resources/Grid.css")
->addStylesheet("/js/dojo/dojox/grid/resources/nihiloGrid.css")
->requireModule("dojo.currency")
->requireModule("dojo.date.locale")
->requireModule("dojo.data.ItemFileWriteStore")
->requireModule("dojo.data.ItemFileReadStore"); ?>
<script type="text/javascript" src="/js/views/spec/index.js"></script>
<script>
<?php
// Setup Datastores for filterselects
foreach ($this->filter as $k=>$v) { ?>
var <?=$k ?>=<?=$v ?>;
var <?=$k.'Store' ?> = new dojo.data.ItemFileReadStore({data: <?=$k ?>});
<?php } ?>
dojo.addOnLoad(function() {
<?php
// Only filter grid now if it has already been filtered once.
if (is_array($this->returnfilter)) { ?>
sfilterGridPage('new');
<?php } ?>
});
</script>
<style>
#content { min-height: 90%; }
.hdrcell { float: left; text-align: center; }
.hdrcell font { font-weight: bold; color: blue; }
</style>
<div id="bordercontainer" jsId="bordercontainer" dojoType="dijit.layout.BorderContainer"
style="/*width: 800px; */ height: 375px; border: 1px solid #ccc;">
<div dojoType="dijit.layout.ContentPane" region="top">
<div class="hdrcell">
<font>SERIES</font><br />
<select id="series_id" jsId="series_id" dojoType="dijit.form.FilteringSelect"
store="seriesStore" searchAttr="label" value="<?=$this->returnfilter['series_id'] ?>"
style="width: 80px;"></select>
</div>
<div class="hdrcell">
<font>TYPE</font><br />
<select id="type_id" jsId="type_id" dojoType="dijit.form.FilteringSelect"
store="typeStore" searchAttr="label" value="<?=$this->returnfilter['type_id'] ?>"
style="width: 80px;"></select>
</div>
<div class="hdrcell">
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('new');">FilterNow</button>
</div>
<div class="hdrcell">
<button dojoType="dijit.form.Button" onclick="location.href='/Spec/edit';">Add New Blank</button>
</div>
</div>
<div dojoType="dijit.layout.ContentPane" region="center" id="ContentPaneCenter" name="ContentPaneCenter">
</div>
<div dojoType="dijit.layout.ContentPane" region="bottom">
<div id="navButtons" style="float: left;">
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('first');">First</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('prev');">Prev</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('next');">Next</button>
<button dojoType="dijit.form.Button" onclick="sfilterGridPage('last');">Last</button>
Page Number:<a id="pagenum" name="pagenum"></a> of <a id="pagecount" name="pagecount"></a>
</div>
</div>
</div>
---------------------------------------------------------------------------------------------------------------------
/js/views/spec/index.js
---------------------------------------------------------------------------------------------------------------------
// Data Grid layout
gridLayout = [{
defaultCell: { width: 4, styles: 'text-align: Right;',
editable: false },
rows: [
{ name: 'DESCR', field: 'key', width: 25, styles: 'text-align: Left;' },
{ name: '4/4', field: 'four', formatter: reformat },
{ name: '6/4', field: 'six', formatter: reformat },
{ name: 'VNR', field: 'veneer', formatter: reformat },
{ name: 'MDF', field: 'mdf', formatter: reformat },
{ name: 'PLY', field: 'ply', formatter: reformat },
{ name: 'MLoss', field: 'materialloss', formatter: reformat, editable: true },
{ name: 'Minutes', field: 'minutes', formatter: reformat, editable: true },
{ name: 'PrgLne', field: 'linenum', width: 6, styles: 'text-align: Left;' },
{ name: 'OptGrp', field: 'optiongroup', width: 7, styles: 'text-align: Left;' },
{ name: 'LChng', field: 'lastmodified', formatter: dateformat, styles: 'text-align: center;' },
{ name: 'series_id', field: 'series_id', hidden: true },
{ name: 'type_id', field: 'type_id', hidden: true },
{ name: 'models_id', field: 'models_id', hidden: true },
{ name: 'style_id', field: 'style_id', hidden: true },
{ name: 'height_id', field: 'height_id', hidden: true },
{ name: 'width_id', field: 'width_id', hidden: true },
{ name: 'pthickness_id', field: 'pthickness_id', hidden: true },
{ name: 'options_id', field: 'options_id', hidden: true }
]
}];
/*
Create and start the grid
*/
function newGrid() {
if(dojo.exists("grid")) {
grid._refresh();
} else {
var div = document.createElement('div');
div.id = 'grid';
div.name = 'grid';
grid = new dojox.grid.DataGrid({
jsid: 'grid',
store: specdata,
structure: gridLayout,
rowSelector: '0px'
}, div );
dojo.byId('ContentPaneCenter').appendChild(grid.domNode);
grid.startup();
dojo.connect(grid, "onApplyCellEdit", function(value, rindex, field) {
rpcObj.savespecprice(
dijit.byId('grid').store.getValue(dijit.byId('grid').getItem(rindex), 'modelspecs_id'), field, value, rindex
);
});
dojo.connect(grid, "onRowClick", function(e) {
if(e.cell.index==0) { editGrid(e); }
});
}
}
var specdata = new dojo.data.ItemFileWriteStore({ clearOnClose: true, urlPreventCache: true });
/*
server side grid filter with page number
what int pagenumber
itemcount: 0,
totalpages: 0,
perpage: 10,
pagenum: 1,
*/
function sfilterGridPage(what) {
var pull = 'false';
if ( what=='new' ) {
rpcObj.totalpages = 0;
rpcObj.pagenum=1;
pull = 'true';
}
if ( what=='first' && rpcObj.pagenum != 1) {
rpcObj.pagenum=1;
pull = 'true';
}
if ( what=='prev' && rpcObj.pagenum > 1 ) {
rpcObj.pagenum-=1;
pull = 'true';
}
if ( what=='next' && ( rpcObj.pagenum <= rpcObj.totalpages-1 )) {
rpcObj.pagenum+=1;
pull = 'true';
}
if ( what=='last' && rpcObj.pagenum != rpcObj.totalpages ) {
rpcObj.pagenum = rpcObj.totalpages;
pull = 'true';
}
if(pull=='true') {
specdata.close();
var filterby = {
series_id: dijit.byId('series_id').value,
type_id: dijit.byId('type_id').value
};
var url = "/spec/records/pagenum/"+rpcObj.pagenum+"/filterby/" + dojo.toJson(filterby);
specdata._jsonFileUrl = url;
specdata.fetch({
onComplete: function() {
newGrid();
standby.hide();
dojo.byId('pagenum').innerHTML = rpcObj.pagenum;
if (rpcObj.totalpages==0) {
rpcObj.countfilteredset();
}
}
});
}
}
---------------------------------------------------------------------------------------------------------------------
-----Original Message-----
From: shobitha nellutla <shobitha%20nellutla%20%3cnshobi_82@...>
To: rois@...
Subject: Hi
Date: Mon, 9 Nov 2009 18:18:22 +0530 (IST)
Hi, I have seen your reply for pagination wt following place. I'm looking to implement pagination for large dataset. Could you please send me the code if you have implemented it?? I'm very new to Dojo and would like to learn how to do the pagination. http://article.gmane.org/gmane.comp.web.dojo.user/40141 One more thing is that I'm not able to access example.Pagetable that's been given at http://www.dojotoolkit.org/2009/04/09/virtual-scrolling-grids-versus-paging-tables. Do u know how to open it?? it gives me "Not valid archive " error. Any help would be appreciated. Thanks, Shobitha
Now, send attachments up to 25MB with Yahoo! India Mail. Learn how.
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
_______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
_______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
|
|
-- Nathan Toone <toonetown@...> wrote (on Monday, 09 November 2009, 01:51 PM -0700): > Yes - QueryReadStore is read-only... > > If you want a writeable store that works server-side, you'll probably have to > create your own. > > There might be one in dojox.data that you could use as well...but I'm only > familiar with QRS. JsonRestStore works nicely. It also supports querying.
| Free embeddable forum powered by Nabble | Forum Help |