Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: wwWebRepeater not saving problem

$
0
0
Re: wwWebRepeater not saving problem
Web Connection 5.0
Re: wwWebRepeater not saving problem
Nov. 18, 2012
04:16 pm
3NB0YVIELShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Serge Grichmanoff
Serge,

List controls don't automatically save their data back to controls on form submissions. They are meant as display controls not input controls. You can certainly display edit content in these types of list controls, but they won't automatically save back to their data source. There's no way to make that happen automatically on the backend.

You can capture the input values manually (they are all postfixed with numeric values that indicate an index) in a POST back (by explicitly looking at the list) but that's pretty tedious.

Other options are non-inline editing. For standard Postback style applications I'd recommend that - it's better to pop up some alternate UI for editing rather than trying to do it inline unless the data is really ultra simple.

Nowadays, inline editing is typically done with AJAX. This isn't so much a Web Connection issue as an HTML/client side programming issue.

There's some support for this in Web Connection using AJAX, but it's fairly minimal.

There's a Grid example here (comes with the samples)
http://west-wind.com/wconnect/webcontrols/EditableDataGrid.wcsx

Another option is to use one of the AJAX components like jqGrid that provide client side editing in grids, but again you have to manage updates one column or row at a time. I don't have Fox examples for this but here's a .NET example that could be adapted to Web Connection:

http://west-wind.com/WestwindWebToolkit/samples/Ajax/jqGrid.aspx

+++ Rick ---


I'm a math guy, who is growing more and more frustrated trying to get the web to behave as expected...

In essence I need an editable grid; behaviour more like a traditional spreadsheet. I tried working with grids but that didn't work out so well, so, I thought a repeater might be better. The look is closer to what I was hoping for, except, I can't save anything. Perhaps it's my complete lack of knowledge on VFP or perhaps WC, but, inevitably nothing works.

In the case of the repeater, here is what I have in the WC5 form

<code lang = "html">
<ww:wwWebPanel ID="WwWebPanel1" width="990px" Height="500px" ScrollBars="Auto" runat='server'>
<table class="blackborder">
<ww:wwWebRepeater ID="GeoParms" runat="server" DataSource="SocioGeoDemoGraphic_Parms">
<ItemTemplate>
<tr>
<td style="width: 50px;">
<ww:wwWebCheckBox runat="server" ID="chkSelected" />
<htmlcheckbox("chkSelected_" + transform(ID),"", SocioGeoDemoGraphic_Parms.Selected) >
<!-- <ww:wwWebCheckBox ID="WwWebCheckBox1" runat="server" ControlSource="SocioGeoDemoGraphic_Parms.Selected" /> -->
</td>
<td style="width: 500px;">
<%= SocioGeoDemoGraphic_Parms.Description%>
</td>
<td style="width: 100px;">
<ww:wwWebTextBox ID="WwWebLabel1" runat="server"
ControlSource= "SocioGeoDemoGraphic_Parms.value" >
</ww:wwWebTextBox>
</td>
</tr>
</ItemTemplate>
</ww:wwWebRepeater>
</table>
<ww:wwWebButton runat="server" ID="btnSave" Text="Save" Click="btnSave_Click" />
</ww:wwWebPanel>

As you can see I tried testing tying directly to the controlsource as well,but, in either case it simply fails to save.

In the VFP code, here is basically the guts;

Function OnLoad()

This.Page.EnableSessionState = .T.
This.oUser = Createobject("Client_Dataclass")
This.lUserName=Session.GetSessionVar("SGA_username")
This.lblTxtLoggedInAs.Text="Logged in as: " + This.lUserName
This.lbl_junk.preserveproperty("text")

If This.IsPostBack
Else
Select Recno() As Id, Attribute, operator, Descriptio As Description, 000.00 As Value, .F. As Selected ;
FROM Addbs(Config.cDataPath)+"ClientAccess\geodemoparms" Into Cursor SocioGeoDemoGraphic_Parms ReadWrite
Endif

Endfunc
* Onload

Function OnPreRender()
This.RenderGrid()
Endfunc

Function RenderGrid()
This.GEOPARMS.Datasource=[SocioGeoDemoGraphic_Parms]
This.GEOPARMS.DataSourceType = 1
This.databind()
Endfunc

Function btnSave_Click()
Local lnCount, lnX

*** Grab all the checkbox form variables
Dimension laVars[1,2]
lnCount = Request.aFormVars(@laVars,"chkSelected_")

WAIT WINDOW lncount

Select SocioGeoDemoGraphic_Parms

*** Because we're dealing with checkboxes which don't post values back if not set
*** we have to update all values to unselected first.
*** If you're running against a full table you'd have to filter this update to match
*** your subset
*Update SocioGeoDemoGraphic_Parms Set Selected = .F. && where customerId = lnCustId

For lnX = 1 To lnCount
*** Grab the id from the Field ID
lnId = Val(Strtran(laVars[lnX,1],"chkSelected_"))
Update SocioGeoDemoGraphic_Parms Where Id = lnId Set Selected = .T.
Endfor

Endfunc

I trapped the result of lncount; the value is 0. Obviously I screwed up since I am apperantly gathering nothing... I have also checked to edit the cursor and you can...

What the heck am I doing wrong????

Serge



Rick Strahl
West Wind Technologies


from Maui, Hawaii

Making waves on the Web


Viewing all articles
Browse latest Browse all 10393

Trending Articles