PDA

View Full Version : [CLOSED] GridPanel One-to-many V2.5 with Single rowSelectionModel and Extra Parameter



jmilton
Dec 07, 2015, 9:29 PM
I am updating a VisualStudio project and moving from Coolite to Ext.Net 2.5. My model works in the old version but will not update the details grid in the new version.

I am using the GridPanel one-to-many example with a sqldatasource. I have data in both of my stores



<SelectionModel>
<ext:RowSelectionModel ID="rsmMyGroup" runat="server" Mode="Single" >
<DirectEvents>
<Select OnEvent="RowSelectGroup" Buffer="250">
<EventMask ShowMask="true" Target="Page" />
<ExtraParams>
<ext:Parameter Name="myGroupID" Value="this.getSelected().get('myGroupID')" Mode="Raw" />
<ext:Parameter Name="Values" Value="Ext.encode(#{gpMyGroups}.getRowsValues())" Mode="Raw" />
</ExtraParams>
</Select>
</DirectEvents>
</ext:RowSelectionModel>
</SelectionModel>





protected void RowSelectGroup(object sender, Ext.Net.DirectEventArgs e)
{
//Comment: Sets fields in Details Panel
string s = e.ExtraParams["Values"];
Dictionary<string, string> MyGroup = Ext.Net.JSON.Deserialize<Dictionary<string, string>[]>(s)[0];


string myGroupID = MyGroup["myGroupID"];
this.txtMyGroupID.Text = myGroupID; //textbox to hold myGroupID value
this.datasetPanel2.SelectParameters["myGroupID"].DefaultValue = myGroupID;
this.storePanel2.DataBind();
}


Any help as to why the new model doesn't bind the details panel would be appreciated.

Daniil
Dec 08, 2015, 10:57 AM
Hi @jmilton,

It is difficult to say anything certain without a test case to reproduce, but I also understand that it is difficult to provide a test case because of a dependency on SqlDataSource.

Okay, first I'll try to ask something. Maybe, it will be enough to troubleshoot.

Please post the definition of the storePanel2 Store and a response of a RowSelectGroup call.

jmilton
Dec 08, 2015, 1:12 PM
<ext:Store ID="storePanel2" runat="server" AutoLoad="true" DataSourceID="dsItemsInGroup" OnRefreshData="stItemsInGroup_RefreshData" >
<Model>
<ext:Model runat="server" ReaderID="myGroupList">
<Fields>
<ext:ModelField Name="MyGroupD" />
<ext:ModelField Name="Item_ID" />
<ext:ModelField Name="Item_Name" />
<ext:ModelField Name="Item_Note" />
<ext:ModelField Name="ItemCount" />
<ext:ModelField Name="Active" />
</Fields>
</ext:Model>
</Model>
<Listeners>
<Exception Handler="Ext.Msg.alert('List - Load failed', e.message || response.statusText);" />
</Listeners>
</ext:Store>




protected void stItemsInGroup_RefreshData(object sender, Ext.Net.StoreReadDataEventArgs e)
{
this.dsItemsInGroup.SelectParameters["MyGroupID"].DefaultValue = this.txtMyGroupID.Text.ToString();
this.storePanel2.DataBind();
}


The RowSelect from the first grid is supposed to pass a parameter to the store for the second panel.

In my first version (with Coolite) everything works. After I updated to the new version of Ext.Net - the myGroupId from the first grid doesn't seen to change (when a different row is selected) and the second grid doesn't load or refresh.

Daniil
Dec 08, 2015, 7:32 PM
Thank you for posting the Store's configuration.

There is no ReaderID property on a Model: ReaderID="myGroupList"

Please put the Reader into the Store as follows:


<ext:Store runat="server">
<Reader>
<ext:JsonReader>
...
</ext:JsonReader>
</Reader>
</ext:Store>

If it doesn't help, then please post the Reader's definition and this request is actual:

Please post ... a response of a RowSelectGroup call.



As for:


The RowSelect from the first grid is supposed to pass a parameter to the store for the second panel.

Please clarify have you ensured by debugging that the parameter is still passed?


In my first version (with Coolite) everything works. After I updated to the new version of Ext.Net - the myGroupId from the first grid doesn't seen to change (when a different row is selected) and the second grid doesn't load or refresh.

Thanks for the details. We are now troubleshooting this issue with you.

jmilton
Dec 09, 2015, 2:06 PM
Previously I stated:


<SelectionModel>
<ext:RowSelectionModel ID="rsmMyGroup" runat="server" Mode="Single" >
<DirectEvents>
<Select OnEvent="RowSelectGroup" Buffer="250">
<EventMask ShowMask="true" Target="Page" />
<ExtraParams>
<ext:Parameter Name="myGroupID" Value="this.getSelected().get('myGroupID')" Mode="Raw" />
<ext:Parameter Name="Values" Value="Ext.encode(#{gpMyGroups}.getRowsValues())" Mode="Raw" />
</ExtraParams>
</Select>
</DirectEvents>
</ext:RowSelectionModel>
</SelectionModel>


The One-To-Many example uses a different selection model:


<SelectionModel>
<ext:RowSelectionModel runat="server" Mode="Single">
<Listeners>
<Select Handler="if (#{pnlSouth}.isVisible()) {#{Store2}.reload();}" Buffer="250" />
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>


In my example, the value of e.ExtraParameter doesn't change when a new row is selected and only passes the value of myGroupID from the first row in the grid.

Daniil
Dec 09, 2015, 2:46 PM
Thank you for the details.

I noticed that you don't use this Parameter in the RowSelectGroup server side handler.

<ext:Parameter Name="myGroupID" Value="this.getSelected().get('myGroupID')" Mode="Raw" />

You always take the first record:

Dictionary<string, string> MyGroup = Ext.Net.JSON.Deserialize<Dictionary<string, string>[]>(s)[0];

jmilton
Dec 09, 2015, 2:51 PM
Daniil,

Isn't that the first item in the string that is passed in the ExtraParameters and not the data from the first row of the top grid?

Daniil
Dec 10, 2015, 11:12 AM
string s = e.ExtraParams["Values"];
Dictionary<string, string> MyGroup = Ext.Net.JSON.Deserialize<Dictionary<string, string>[]>(s)[0];
The MyGroup variable contains the first row of the gpMyGroups GridPanel.

To get this

<ext:Parameter Name="myGroupID" Value="this.getSelected().get('myGroupID')" Mode="Raw" />
on server side please use

e.ExtraParams["myGroupID"]

jmilton
Dec 10, 2015, 5:11 PM
Daniil,

The value returned for e.ExtraParams["myGroupID"] is null.

Daniil
Dec 11, 2015, 12:46 PM
Please try to replace

<ext:Parameter Name="myGroupID" Value="this.getSelected().get('myGroupID')" Mode="Raw" />
with

<ext:Parameter Name="myGroupID" Value="record.get('myGroupID')" Mode="Raw" />

jmilton
Dec 14, 2015, 7:08 PM
Daniil,

Great. That works for myGroupID but I no longer get the ExtraParameters in:



<ext:Parameter Name="Values" Value="Ext.encode(#{gpMyGroups}.getRowsValues())" Mode="Raw" />


with



string s = e.ExtraParams["Values"];
Dictionary<string, string> myGroup = Ext.Net.JSON.Deserialize<Dictionary<string, string>[]>(s)[0];

Daniil
Dec 15, 2015, 2:25 PM
I don't quite have any ideas how that change could affect it.

Could you, please, provide a full test case? With some dummy static data instead of a database.