I couldn't find the answer to this anywhere so I had to resort to ask here...
Is it possible to use a List View but instead:
<ListView>
<Row>
<Text> Row 1 </Text>
</Row>
<Row>
<Text> Row 2 </Text>
</Row>
</ListView>
Basically lay it out statically instead of using a render row, Especially if each row is going to have a much different layout. Using a render row function kinda makes it a pain to not have all identical layouts
Related
I'm writing a user management using react-admin and try to make adding users to groups easier, i.e. by adding groups from a user's edit page using auto-complete. Starting with an example, I've got some success using the following:
<ReferenceArrayInput
label="Group"
source="groups"
reference="groups"
>
<AutocompleteArrayInput
{...props}
resettable={true}
allowEmpty={true}
optionText="name"
fullWidth
/>
</ReferenceArrayInput>
However, this method uses Chip component to display selected items inline. I would like to use a Datagrid instead. I know from the source code that I cannot override the display part of an auto-complete (yet?), so I thought I could resort to hiding Chips via CSS, but I would still need a way to display a Datagrid with current selection. So I tried this (it's wrapped in FormWithRedirect, hence formProps):
<ReferenceArrayField
{...formProps}
label="Group"
source="groups"
reference="groups"
>
<Datagrid>
<TextField source="name" />
</Datagrid>
</ReferenceArrayField>
<ReferenceArrayInput
{...formProps}
label="Group"
source="groups"
reference="groups"
>
<AutocompleteArrayInput
resettable={true}
allowEmpty={true}
optionText="name"
fullWidth
/>
</ReferenceArrayInput>
This works almost exactly as I want it, a Datagrid is displayed and it shows the right data for the selection, however, it's not updated when selected items on AutocompleteArrayInput change. How ever I tried (been through probably all the hooks and contexts), I could not make it work.
Is this possible? How can I make Datagrid update when selection changes on AutocompleteArrayInput?
ive tried many/multiple ways to get this to work but just cant as yet, so would appreciate anyone's assistance.
i have a view as follows :
"LBProw.xml"
<Alloy>
<TableViewRow id="LBProw" >
<ScrollableView id="sView" >
<View id="view1" >
<!-- text labels on the row -->
<Label id="LBPheading" > </Label>
<Label id="myLabel1" > </Label>
<Label id="myLabel2" > </Label>
</View>
</ScrollableView>
</TableViewRow>
</Alloy>
adding rows to the table is working 100% fine.
what i cant work out, is how can I loop through the previously created tableview rows, access the rows (custom) fields values, and then do something with those values. I need to access these rows (and their custom row fields values) from a different JS file.
eg. somelogic.JS <--- loop thru the table view rows, retrieve the rows custom field values and then use those values (note that $.myTable is directly accessible from this JS file)
as an example, i tried using the following but could not work out how to get the individual rows custom fields values (the label values for "LBPheading", "myLabel1", "myLabel2")
// loop thru the rows
for (i = 0; i < $.myTable.data[0].rows.length; i++) {`
Ti.API.info('row #' + i);
?? $.myTable.data[0].rows[i].???? <== how can i get the rows (custom) field values ?
}
I think, it has to do with the embedded ScrollableView and View in the row ? but I cant figure out how to reference the Label(s) within that structure.
Really appreciate any assistance/advice.
IMHO you are doing it the wrong way, the UI is just for presentation and you should keep track of the model associated with each row. When the user selects a row, query the collection and retrieve the associated model... that should contain the information you are looking for
Here is a good example for you to refer to. It is made in Alloy, custom rows, and dynamic updates to the tableview.
http://docs.appcelerator.com/titanium/latest/#!/guide/Alloy_Samples-section-37535160_AlloySamples-TodoList
In my Metro app, I have some code that builds up a TileWidePeekImageCollection06 (I assume this question applies to TileWidePeekImageCollection05, too), as shown here.
If I supply 6 images, then the sixth is shown in the "peek" along with the text, if I supply 5 then it looks like the fifth is shown with the text. However, if I supply less than 5 images, I can't seem to determine which is shown.
What are the rules for this? I need to know because the text shown in the "peek" with a single image needs to relate specifically to that image.
The documentation isn't very explicit, but you could find this out pretty easily through experimentation. Alternatively, you could use the object model that provides friendly names in the NotificationsExtensions helper library in the tiles sample on MSDN (or look directly at the source mapping the friendly names to the identifiers in the helper library source: TileContent.cs).
For the specific template you mentioned, example XML is provided below with details about each image provided in the alt tag.
<tile>
<visual>
<binding template="TileWidePeekImageCollection06">
<image id="1" src="image1.png" alt="Main image on top"/>
<image id="2" src="image2.png" alt="Small image - row 1, column 1"/>
<image id="3" src="image3.png" alt="Small image - row 1, column 2"/>
<image id="4" src="image4.png" alt="Small image - row 2, column 1"/>
<image id="5" src="image5.png" alt="Small image - row 2, column 2"/>
<image id="6" src="image6.png" alt="Image with text"/>
<text id="1">Text Header Field 1</text>
</binding>
</visual>
</tile>
I'm editing the original post here to clarify and hopefully I have boiled it down into something more manageable. I have a string of xml that looks something like:
<foo id="foo">
<row>
<img alt="jules.png" src="http://localhost/jules.png" height="1024" width="764">
</row>
<row>
<img alt="hairfire.png" src="http://localhost/hairfire.png" height="225" width="225">
</row>
</foo>
So, I'm doing something like:
xml = BeautifulStoneSoup(someXml, selfClosingTags=['img'], convertEntities=BeautifulSoup.HTML_ENTITIES)
The result of that is something like:
<foo id="foo">
<row>
<img alt="jules.png" src="http://localhost/jules.png" height="1024" width="764">
</row>
<row>
<img alt="hairfire.png" src="http://localhost/hairfire.png" height="225" width="225">
</row>
</foo>
Notice there are no closing tags on the img tags in each . Not sure this is my issue, but possible. When I try and do:
images = xml.findAll('img')
it's is yielding an empty list. Any ideas why BeautifulStoneSoup wouldn't find my images in this snippet of xml?
The reason you are not finding the img tags is because BeautifulSoup is treating them as the text part of the "row" tag. Converting entities just changes the strings, it doesn't change the underlying structure of the document. The following isn't a great solution (it parses the document twice), but it worked when I tested it on your sample xml. The idea here is to convert the text to bad xml, then have beautiful soup clean it up again.
soup = BeautifulSoup(BeautifulSoup(text,convertEntities=BeautifulSoup.HTML_ENTITIES).prettify())
print soup.findAll('img')
I want to print the results of an SQL query in XUL with word-wrapping using the description tag. I have the following code:
<grid>
<columns>
<column flex="2" />
<column flex="1" />
</columns>
<rows datasources="chrome://glossary/content/db/development.sqlite3" ref="?" querytype="storage" >
<template>
<query>select distinct * from Terms</query>
<action>
<row uri="?">
<description value="?name" />
<description value="?desc" />
</row>
</action>
</template>
</rows>
This works for printing the data, but since I'm using the value attribute of description, there's no word-wrapping. I don't understand entirely what I'm doing with the value attribute, but I don't seem to be able to get the values of my SQL query in any other way. So, how could I get those values without the value tag?
Thanks.
So, if anyone's ever looking, I found this out on IRC:
You can use a textnode element to do this.
<description><textnode value="?name" /></description>
This will give you line-wrapping.