0

Action one item from a Database.

Lcdrgreg 7 years ago updated by icahill (Administrator) 7 years ago 7
We are creating an app that as one part has a "to do" list.  I want to be able to alpha on and off a line/panel "onswipe" for that item.  Possible?
      If you are using json you can do this onswipe: 
    <assign property="datasource:datasource1.removeIndex" value='3'/>

I guess I didnt explain it very well at all.  I dont want to delete the item from the database.  It is a locally created sql db.  I just want to run a line through the text, basically annotating that the item was completed.
applicable code below.

sorry and thanks ian.

<code>

<class name="checklist">
<panel name="chore" xpos="0%" ypos="0%" height="12%" width="100%" borderwidth="1" bordercolor="black" _choretxt="" onswiperight="lineout">
<text name="choretxt" alias="CHORETXT" text="" font="HelveticaNeue-bold" color="#000000" size="28" width="82%" xpos="18%" height="fit" valign="center" alignment="left"/>
<image name="icon" source="" height="90%" width="17%" valign="center" align="left" contain="yes" ></image>
<panel name="lineout" alias="LINEOUT" width="75%" height="3" xpos="20%" valign="center" background="#000000" alpha="0"></panel>
</panel>
</class>


<list name="checklist" width="100%" height="75%" datasource="checklist5-items" orientation="vertical" paginate="no" ypos="10%" alpha="1">
<object name="item" choretxt="" icon=""/>
</list>

<action name="lineout">
<alert message="choretxt"/>
<if lhs="test" operator="e" rhs="_choretxt">
<alpha time=".25" value="1" target="LINEOUT"/>
</if>
</action>

</code>



Interesting. Well as long as the LINEOUT panel is in the class and doesn't have a dynamic name, it will apply to every item in the list, so you would need to give it a name and an alias that coincides with the datasourceIndex. That way on swipe you can capture the item number and set only that item to alpha on. 

So you would be saying onswipe alpha on LINEOUT-2 (LINEOUT-[param:datasourceIndex]).

Sorry tried that, still does not action that item.

<code>
<classes>
<class name="checklist">
<panel name="chore" xpos="0%" ypos="0%" height="12%" width="100%" borderwidth="1" bordercolor="black" _choretxt="" onswiperight="lineout">
<text name="choretxt" alias="CHORETXT" text="" font="HelveticaNeue-bold" color="#000000" size="28" width="82%" xpos="18%" height="fit" valign="center" alignment="left"/>
<image name="icon" source="" height="90%" width="17%" valign="center" align="left" contain="yes" ></image>
<panel name="lineout-" alias="LINEOUT-" dsindex="" width="75%" height="3" xpos="20%" valign="center" background="#000000" alpha="0"></panel>
</panel>
</class>

<list name="checklist" width="100%" height="75%" datasource="checklist5-items" orientation="vertical" paginate="no" ypos="10%" alpha="1">
<object name="item" choretxt="" icon="" dataSourceIndex="[param:dataSourceIndex]"/>
</list>

<action name="lineout">
<alert message="" />
<alpha time=".25" value="1" target="LINEOUT-[param:dataSourceIndex"/>
</action>




</code>
It seems like your code is incomplete in this example. Your class has no params? 

Your lineout panel should look something like this :

<panel name="lineout-[param:dataSourceIndex]" alias="LINEOUT-[param:dataSourceIndex]" dsindex="[param:dataSourceIndex]" width="75%" height="3" xpos="20%" valign="center" background="#000000" alpha="0"></panel>
That is exactly what it reads, for some reason the copy and paste did not paste the params.
Can you email me your app id so I can take a look?