PDA

View Full Version : [CLOSED] Read selected items server side (additional columns)



CanopiusApplications
Jul 28, 2014, 3:31 PM
Hi

Lets say we have a multi column & multi select combo with 5 different columns.
In jscript I read the selected items value for the other columns like this


var value = combo.getValue();
combo.findRecordByValue(value).data.Column1);
combo.findRecordByValue(value).data.Column2);

How do I this from server code as the SelectedItems only contains Text and Value and not any of the additional columns (or at least that I can tell)?

Ta,
Dan

Vladimir
Jul 28, 2014, 4:05 PM
What column do yuo mean? I am not sure what means column on Combobox context
Can you provide test sample?

Also, if you can extract required information via javascript then you can send it to the server as extra parameter of direct event

CanopiusApplications
Jul 28, 2014, 5:12 PM
Hi Vlad

By the additional columns I mean those extra columns on the store shown for a multi column combo




<ext:MultiCombo ID="_Analysis" runat="server" MatchFieldWidth="true" Flex="1" FieldLabel="Analysis Name" ValueField="AnalysisID" DisplayField="AnalysisName" >

<Store>
<ext:Store ID="stAnalysis" runat="server">
<Model>
<ext:Model ID="mdlAnalysis" runat="server" IDProperty="AnalysisID">
<Fields>
<ext:ModelField Name="AnalysisID" />
<ext:ModelField Name="AnalysisName" />
<ext:ModelField Name="AnalysisDescription" />
<ext:ModelField Name="AnalysisCurrency" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>


Given it is also a multi select combo I would need to wrap up all selected items and post them to server. It would also not be very clean as this happens behind a save event of a button click so I would end up writing quite a bit of code whereas it would be far easier if I could simply read the other columns (Description and Currency) as part of the selecteditems.

Ta,
D

Vladimir
Jul 28, 2014, 5:21 PM
I see, under column you mean additional store fields
A store can contain many fields but combo works with only two fields: display field and value field
If you need additional field then you have to submit it manually via extra parameters of direct event

Or just get store data on the server and read records by value (i mean that you should know what data inside the store and you can get that data (for example, read from DB and etc) on the server)

CanopiusApplications
Jul 29, 2014, 9:00 AM
Thanks Vlad.

Yeah I pretty guessed that would be the case. The way I see it is there are 3 options.

1. Wrap up the selected items and pass them thru a listener / event.

2. Go back to the db, in this case everything about how they are retrieved in the first place is dynamic (including servers & dbs) -- I can certainly do it this way but it is potentially expensive and is shame given we have the data.

3. Persist the data on the server and lookup from there.

Either way I think the problem might more to be with me trying to do too much using a multi column & multi select combo. I also have it working now using display text and display value (although I can see the need for further fields).

Thanks,
D

Daniil
Jul 30, 2014, 6:18 AM
Hi @CanopiusApplications,


but it is potentially expensive and is shame given we have the data.

Yes, it is a proper principle not to retrieve the data again if you already have it.

I think you can send anything that required from client. As far as I can understand you have stated it in the option #1.