I have made a listdefinition which I've put in to a web scoped feature which I've added to WebFeatures in my sitedefinition. In my sitedefinition I've added a list view web part which shall display the list created through the listdefinition. My issue is that when I add the list's name to the List property in the list view web part like so:
<View List="OrderList" BaseViewID="1" WebPartZoneID="Footer" WebPartOrder="2">
</View>
the process of creating the new sub site fails because of this alone. I have 2 other lists which is added to the sitedefinition in the exact same way
<View List="Documents" BaseViewID="1" Type="HTML" WebPartZoneID="Footer" WebPartOrder="1">
</View>
<View List="108" BaseViewID="3" WebPartZoneID="Footer" ContentTypeID="0x012001" WebPartOrder="4">
</View>
The only difference is that those 2 lists are standard sharepoint Documents library and Discussion board. If I remove the custom list's list view web part the entire flow works correctly, but as soon as I add it the entire thing fails.
I've created the listdefinition through VS2010 own listdefinition template etc and I haven't touched a thing. Only changed the name in the List Instance and made sure everything matched in the Elements.xml and Schema.xml files
What is the Url attribute of your ListInstance?
Because the List attribute of the View element must match the Url from the ListInstance. For example, if your ListInstance is defined as:
<ListInstance
FeatureId="00000000-0000-0000-0000-000000000000"
TemplateType="0000"
Title="My Test List"
Url="Lists/OrderList">
</ListInstance>
then your View must be:
<View List="Lists/OrderList" BaseViewID="1" WebPartZoneID="Footer" WebPartOrder="2">
</View>
Related
I have two PNG-files:
Resoucres/Images/image1.png and Resoucres/Images/subfolder/image2.png
so, I want to set they as Source for Image:
when I set 1st image:
<Image ... Source="image1.png" />
all working correctly, but when I try to set 2nd image:
<Image ... Source="subfolder.image2.png" />
image isn't displaying.
So, how I need to write the path of the 2nd image?
An image can be added to your app project by dragging it into the Resources\Images folder of the project, where its build action will automatically be set to MauiImage.
Images can also be added to other folders of your app project. However, in this scenario their build action must be manually set to MauiImage in the Properties window.
So you can right click the image2.png file select the properties then change the Build Action to MauiImage and you can use the image directly.
<Image ... Source="image2.png" />
I noticed that every time an item is displayed in a List resource or a Datagrid component the element's ID property is presented as an IRI string.
I understand this is due to the relationship between HydraAdmin and JSON-LD content negotiation:
Sends proper HTTP requests to the API and decodes them using Hydra and JSON-LD formats
But my (simple) question is: how to display the ID and not the entire context? I only want the last part (the unique ID itself) to be displayed in the Datagrid or List resource column but by no means can I do this even though my API returning an entire ID property cannot display (example image below). Anyway, the value of "#id" (string) is always displayed due to Hydra and JSON-LD relationship.
Debugging the response headers and using useListContext I was able to find that there is an injected property called originId in the data object and that it is possible to display the original ID and not reference it to "#id" as the default for the property ID using as source "originId" and not "id".
in the DataGrid I used source="originId"
...
const {data, ids, basePath} = useListContext();
return (
<Datagrid fullWidth>
// here is the magic, use originId instead id
<TextField source={"originId"} label={"ID"}/>
<TextField source={"created_at"} label={"Data"}/>
<TextField source={"author"} label={"Autor"}/>
<TextField source={"content"} />
<TextField source={"is_public"} />
</Datagrid>
)
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?
I am trying to create a list of dropdowns which can be reordered by dragging them. For drag and drop i am using react-sortable-hoc. Here i am attaching a working sample. Link for sample
To reproduce the issue, Select value in first dropdown by mouse or keyboard. after that drag that element (first dropdown) and drop it at 3rd or 4th position then you observed that dropped dropdown will not persist the value. Selected value displayed at first element. What could be the cause for this? How can i fix it?
You need to pass onSortEnd handler to your srotableContainer as props
<List items={this.state.items} onSortEnd={this.onSortEnd}/>;
I also suggest you add a key on your Item
<Item key={item} data={item} index={index} />
Here is the forked sandbox where it is working:
https://codesandbox.io/s/adoring-raman-l72xw?fontsize=14
I am using v7 and I want to show in a tree view a field with image icons (like a semaphore) depending of other field values in the same row.
Actually, I get the functionality I want with a function field and put the result as string but I really want it as an image. I don't know if is possible to return HTML from the function so I decided to do that with jQuery.
I implemented the jQuery code using the browser console and works but when I put the jQuery code in the view the "data-field" selector does not selected.
Please, can anyone explain me why or tell me another way to get my objective?
Lists
The root element of list views is tree. The list view's root can have the following attributes:
editable, default_order, colors, fonts, create, edit, delete, on_write, string
See more about ListView
You can achieve this by defining child elements button in list view.
I have added icon in product to show whether product is available / hold / sold based on product's status.
button
icon: icon to use to display the button
Xml code to display icon in listview.
<xpath expr="//notebook/page[#string='Order Lines']/field[#name='order_line']/tree[#string='Sales Order Lines']/field[#name='product_id']" position="before">
<field name="product_status" invisible="1" />
<button icon='Hold' readonly="1" attrs="{'invisible':[('product_status', '!=', 'hold')]}"/>
<button icon='Available' readonly="1" attrs="{'invisible':[('product_status', '!=', 'available')]}"/>
<button icon='sold' readonly="1" attrs="{'invisible':[('product_status', '!=', 'sold')]}"/>
</xpath>
NOTE
Remember base field on which you defined button's visibility must be
present on listview, doesn't matter whether it's visible or not but it
must be there, like product_status in above example.
base field must be store=True.
Why store=True ?
Reason: when you set any function field store=True then it will physically created in database, while you give this field name in
domain the odoo framework add this field directly in WHERE clause,
it will not access through browsable object, so if your field is
store=False then it won't be able to find that field and gives you an error.
icons must be present in web/static/src/img/icons.
if you want to keep icons in your custom module then you have to create the same hierarchy for that in side your module folder create /static/src/img/icons and keep all the icons there.
xpath is used to define at which location you want to add/update fields.
See more about xpath