PDA

View Full Version : [CLOSED] Gridpanel: send selected data to server



tanky65
Mar 08, 2013, 3:24 PM
Hi,
I noted that when select data from the a gridpanel store are sent to server via extraparams


Ext.encode(#{GridPanel1}.getRowsValues({selectedOn ly : true}))


and following selection model


<ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" AllowDeselect="true" runat="server"
Mode="Multi">
<Listeners>
<BeforeSelect Handler="enButtonG1(#{GridPanel1});" />
<BeforeDeselect Handler="disButtonG1(#{GridPanel1});" />
</Listeners>
</ext:CheckboxSelectionModel>


if pagingtoolbar on the grid is enabled and some sorting on some columns is done before sending data, the resulting array to the server
doesn't contain the expected rows ..

I guess this problem has just been experienced by someone else, anyway, can you tell me what is the right way to send to server the complete array of selected rows in the gridpanel even when pagintoolbar is used

Thanks in advance




<ext:Button ID="btnSaveToDB" runat="server" Text="Save data" ToolTip="Save data loaded to DB"
Icon="DiskBlack">
<DirectEvents>
<Click OnEvent="sendDataToDB" After="enableFields();">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="Viewport1" />
<ExtraParams>
<ext:Parameter Name="Grid1" Value="Ext.encode(#{GridPanel1}.getRowsValues({selectedOn ly : true}))"
Mode="Raw" />
<ext:Parameter Name="Grid2" Value="Ext.encode(#{GridPanel2}.getRowsValues({selectedOn ly : true}))"
Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>

Daniil
Mar 08, 2013, 5:28 PM
Hi @tanky65,

Are you using remote or local paging?

tanky65
Mar 09, 2013, 8:34 AM
Hi @tanky65,

Are you using remote or local paging?

i'm using local paging

Daniil, I understood the behaviour and why i was getting a row different from the one i selected:

in my application I can select one or more rows on the gridpanel and so i prefer to use checkboxpanel set on multiselect.
Image I have 100 rows paged for 10 rows per set
for the behaviour of the selectionmodel, if you select the checkbox on one row you mark that record, than you can add more selected rows with the same action,
if you click on the row (not on the checkbox) the rows previously selected are deselected but only on the subset of the shown rows (current 10 rows).

So, when I click on the row (not on the checkbox) I would leave selected only the current row on the entire set of the grid, (user could forget some selected rows on the other set of the paged rows)

furthermore, when i click on the select/deselect all checkbox I would the action apply on all rows of the set and of on those of the current page
5786
is it possible?

thanks in advance

tanky65
Mar 10, 2013, 10:30 AM
I can compact what said above with the following

referencing to following example

http://examples2.ext.net/#/GridPanel/Selection_Models/Checkbox_Selection/

the action of the chekbox [select/deselect all] is limited to the rows of the current page. if deselect all on the current page, selected rows on the othe pages remain selected.

is there a way to make the select/deselect action on all items of the buffer?

5787

thanks

Daniil
Mar 11, 2013, 9:44 AM
Yes, that Checkbox deals with a current page only.

I would try to override the CheckboxSelectionModel's onHeaderClick method.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.selection.CheckboxModel-method-onHeaderClick

This example should help to override.
http://forums.ext.net/showthread.php?21368&p=92552&viewfull=1#post92552

tanky65
Mar 13, 2013, 10:49 PM
Thanks to clarify. you can close it