I've created a list report, to which I've extended by adding some custom columns. The problem I'm facing is that my custom columns only work when the CDS field behind it (bind) is being displayed at the standard columns.
I.e
<Column id="ExtensionWizard::Attachments" xmlns="sap.ui.table" width="3em">
...
<Button icon="{= ${dmsDocumentCount} === 0 ? 'sap-icon://warning' : 'sap-icon://attachment' }"
xmlns="sap.m" press="onDisplayAttachments"/>
...
</Column>
Displays this:
And only if I display the dmsDocumentCount column I have the desired output:
I could see that this happens because the oData service is not being requested to return the dmsDocumentCount field.
So your answer can go both ways:
How to force this field to be requested by the OData. Remember I'm extending a list report.
How to achieve the the result (or similar).
Thank you very much for your answers
In your UI.LineItem annotation you can add the UI.Hidden annotation term such as
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="dmsDocumentCount"/>
<Annotation Term="UI.Hidden" Bool="true"/>
</Record>
The field will be requested but not shown in the table.
Related
I have this DevExpress GridControl that is dynamically created using a CellTemplateSelector. One of the GridControl columns is defined by a DataTemplate that appears as follows:
<DataTemplate x:Key="NameComboColumnTemplate">
<ContentControl>
<dxg:GridColumn
x:Name="GridColumnName"
FieldName="{Binding Path=(dxci:DependencyObjectExtensions.DataContext).FieldName, RelativeSource={RelativeSource Self}}"
Header="{Binding Path=(dxci:DependencyObjectExtensions.DataContext).Header, RelativeSource={RelativeSource Self}}"
Width="{Binding Path=(dxci:DependencyObjectExtensions.DataContext).Width, RelativeSource={RelativeSource Self}}">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<dxe:ComboBoxEdit
IsTextEditable="False"
SelectedItem="{Binding RowData.Row.SelectedCylinderName, Mode=TwoWay}"
ItemsSource="{Binding RowData.Row.NameList, Mode=TwoWay}">
<dxe:ComboBoxEdit.ItemContainerStyle>
<Style TargetType="dxe:ComboBoxEditItem">
<Setter Property="dxb:BarManager.DXContextMenu">
<Setter.Value>
<dxb:PopupMenu>
<dxb:BarButtonItem
x:Name="BarButtonItemName"
Content="Delete"
Command="{Binding DeleteNameCommand}"
CommandParameter="{Binding}"/>
</dxb:PopupMenu>
</Setter.Value>
</Setter>
</Style>
</dxe:ComboBoxEdit.ItemContainerStyle>
</dxe:ComboBoxEdit>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
</ContentControl>
</DataTemplate>
There exists a class called DataGridRow, that contains properties for ONE row of GridControl data. This class also contains a command defined as
public ICommand DeleteNameCommand => new DelegateCommand<object>(obj => DeleteName(obj));
private void DeleteName(object obj)
{
// the obj parametercontains the text present on the ComboBoxEdit list item that was
// right-clicked to display the context menu.
// Delete the name from the list here
}
As shown above, the ComboBoxEdit SelectedItem and ItemsSource properties are bound to DataGridRow properties accessed via the RowData.Row property, and the DeleteNameCommand is also accessible via the RowData.Row property.
When the user clicks the ComboBoxEdit down-arrow, the list of Names is displayed, and when the user right-clicks a list name, the context menu is displayed. Since the PopupMenu/BarButtonItem is not part of the Visual Tree, how would I bind the BarButtonItem Command property to the RowData.Row property accessed in the ComboBoxEdit? ... and how could I pass the text of the ComboBoxEdit list item that was right-clicked as the value of the CommandParameter?
Any pointers to the right direction are very much appreciated.
OK ... after days of trying to figure this out, the great people at DevExpress were able to provide me with a solution. My apologies for posting the question as I did not expect (my bad) to get a solution so quickly (I asked them yesterday afternoon), but I thought it useful to inform the community of the solution.
The ComboBoxEdit editor data context is accessible via
(dxe:BaseEdit.OwnerEdit).DataContext
and to access the associated RowData.Row property, which itself contains the properties usable for each row column, is accessible via
(dxe:BaseEdit.OwnerEdit).DataContext.RowData.Row
SO, it follows that the PopupMenu/BarButtonItem Command can be bound to the DeleteNameCommand contained in the DataGridRow class, which itself is accessible via RowData.Row by specifying the following:
Command="{Binding Path=(dxe:BaseEdit.OwnerEdit).DataContext.RowData.Row.DeleteNameCommand, RelativeSource={RelativeSource Self}}"
... and the text of the ComboBoxEdit list item that was right-clicked is available to pass as the value for CommandParameter via the following declaration:
CommandParameter="{Binding}"
... and there was much rejoicing :-)
I am creating a dropdown in XUL like this:
<button id="bid" oncommand="alert(event.target.nodeName)" >
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</button>
I want to alert the value of nodeitem which is being clicked. Using event.target.nodeName giving nodeName as menuitem but using nodeValue is retuning undefined as it starts to take value of button node. How can I get the value of the menuitem clicked. I also tried $(this).val() but even that gave undefined. Using $(this).attr('value')
also didn't help. I can put oncommand for menuitem but that doesn't seem to be actual solution. Is that the only way or some method exist to get the value?
The XUL code you have in the question is non-functional. Either you should be using a <menulist> instead of a <button>, or your <button> needs the property type="menu" or type="menu-button". If you are going to use a <button> without the type="menu" property, you would actually have to open a popup in the command event handler for the <button> and then select from there. That does not appear to be what you are wanting. It is, however, quite doable. I use a construction like that in one of my add-ons, except I have it open when one of several <label> items is clicked. This allows re-use of a single <menupopup> for multiple different items in the window. In that case, the <menupopup> is a rather large amount XUL code that I did not want to repeat and maintain multiple duplicates in the XUL for the window.
The value of the <menuitem> selected:
Your actual question is how to get the value of the <menuitem> selected by the user. All of the code below is tested and functional. As you can see from the code you can get the value of the <menuitem> you select (at the time of selection) from: event.target.value.
Using a <menulist> element:
The most common element to use would be a <menulist>. This would normally be used when you are having the user select from multiple options a choice that is going to be remembered and used later, or used to adjust what is presented in the user interface. It would generally not be used to select from multiple immediate actions (which are acted upon and the choice not remembered). A <menulist> is what is used in the examples for <menuitem> and <menupopup> on MDN.
<menulist id="bid2" oncommand="alert(event.target.value)" >
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</menulist>
The above code will give you what looks like a button with a selection of <menuitem> entries when you click on it. It will alert with the value of the <menuitem> you have selected.
This will produce an item that looks like:
Which you can click on to open a drop-down list:
If you select an item:
You will get an alert:
And the object will then show your selection:
Using a <button> element:
It is also possible to use a <button> element with the property type="menu" or type="menu-button" specified. However, this provides no visual feedback to the user as to which option is currently selected. [Note: Your JavaScript could manually change the <button> label property to provide this feedback.] You could use this type of element if it is button that produces an immediate action rather than a selection that is remembered.
The code:
<button type="menu" id="bid2" label="A Button" oncommand="alert(event.target.value)">
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</button>
This will produce an item that looks like:
Which you can click on to open a drop-down list:
If you select an item:
You will get an alert:
And the object will then NOT show your selection:
If you want to set the label of the <button> to reflect the selection made by the user, you could use:
<button type="menu" id="bid2" label="A Button" oncommand="event.target.parentElement.parentElement.label=event.target.value;alert(event.target.value)">
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</button>
When three is selected, that will result in a button that looks like:
Using a <toolbarbutton>:
You could, alternately, use a <toolbarbutton>.
When not hovered, doing so would look like:
When hovered:
When open for selection:
Choices in UI design:
There are many choices that you have to make when designing your user interface. There are many different ways to get to the same effective result, with somewhat different look and feel. You really should be trying these types of options on your own. You may find the XULRunner program XUL Explorer to be of use when prototyping XUL.
Selecting UI elements and a look and feel is, in my opinion, beyond the scope of questions on stackoverflow. While you probably won't get specific XUL help, you can ask UI design questions at: the User Experience stack exchange.
I have jsf validation on form where the invalid fields are highlighted based on
styleClass="#{component.valid ? 'reportInput' : 'reportInput_invalid'}"
and a tooltip is being used for displaying the error message as follows
<p:tooltip for="inputFieldId">
<p:message for="inputFieldId" />
</p:tooltip>
Everything works as expected but i want to improve user experience and want to introduce pure client side validation using
<p:clientValidator />
I tried this but it didnt work when onBlur event is fired on inputfield i got the following JS error
'null' is Null or no Object
in validation.js.jsf and the line code is
d.data("uiMessageId",b.attr("id"))
Is it possible to achieve?
An example of my input field is:
<p:inputText id="bic"
styleClass="#{component.valid ? 'reportInput' : 'reportInput_invalid'}"
value="#{bean.bic}"
required="true" requiredMessage="Field value is required" >
<p:watermark for="bic" value="CMHJKLIL" />
<pe:keyFilter regEx="/[a-z0-9]/i" />
<f:validateLength minimum="8" />
<p:clientValidator/>
</p:inputText>
I am using Primefaces 4 with the following maven dependency
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>4.0</version>
</dependency>
Here as it looks in jsf page head section
Here is the validation.js file that is being used
validatuion.js here
i had the exact same error.
it seems that the validator.js code searches for a message container attached to the field, and, if cant find one, it searches one in the nearest form "e.findUIMessage(a,d.closest("form").find("div.ui-message"))"
what you need is to have an tag,
that is, a message assigned for the inputtext, so, when the validator generates an error, it can post the text in that message container.
I've been trying to create a batch update program for a MOSS site, based on the MSDN example here: http://msdn.microsoft.com/en-us/library/cc404818.aspx. Unfortunately, although the update query is running through with no errors, the data in the list is not changing.
Here is the batch command I use:
<Method ID="3767">
<SetList>8468cf0a-7e10-439c-a9b4-4197543e7b38</SetList>
<SetVar Name="Cmd">Save</SetVar>
<SetVar Name="ID">3767</SetVar>
<SetVar Name="Date_x0020_of_x0020_Birth1">1971-12-18T00:00:00Z</SetVar>
</Method>
Upon running the batch update command:
string batchReturn = web.ProcessBatchData(batch);
returns:
<Results>
<Result ID="3767" Code="0"></Result>
</Results>
The major version number on the list item is incremented, but no changes are made to the data in field: Date_x0020_of_x0020_Birth1
I'm stumped.
More background: Date_x0020_of_x0020_Birth1 is a new field added to the default content type fo this list. It is a DateTime field. It supercedes the original Date_x0020_of_x0020_Birth field (now has a display name of "Date of Birth(Text)") which was a text field, dues o it containing values prior to 01/01/1900. The batch update is to copy dates from the text field to the new DateTime field where possible.
The only thing I can think off is that I'm using:
<SetVar Name="Cmd">Save</SetVar>
Perhaps I need the "Update" or "Save" command, so I tried this:
<Method ID="1" Cmd="Update">
<Field Name='ID'>3767</Field>
<Field Name="Date_x0020_of_x0020_Birth1">1971-12-18T00:00:00Z</Field>
</Method>
But that returns:
<Results>37671971-12-18T00:00:00Z<Result ID="1" Code="-2130575350">
<ErrorText>Invalid URL Parameter
The URL provided contains an invalid Command or Value. Please check the URL again.
</ErrorText>
</Result>
3767Date_x0020_of_x0020_Birth1
<Result ID="1" Code="-2147023673">
<ErrorText>The operation failed because an unexpected error occurred. (Result Code: 0x800704c7)</ErrorText>
</Result>
</Results>
"Update" is the right CMD, and it sounds like the update is occuring fine (updating the version number).
That just leaves the field, and it is probably the "Name" you are using.
Did you try using the urn prefix (urn:schemas-microsoft-com:office:office#Date_x0020_of_x0020_Birth1)
Can you try updating a different field, like the title. (urn:schemas-microsoft-com:office:office#Title)
If that all fails you could try using the UpdateListItems on the lists.asmx
I successfully created tables with style that salesforce provided. (like the one that highlighted on mouseover etc)
But I want the value of column to be a link to display detail info of the object.
When I don't create my own visualforce page, the table looks nice and the column
values (records) are all hyperlinked but can't figure out how to do it from visualforce apex code.
pageBlockTable and column definition does not seem to have attributes or anything that
make it hyperlink.
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_pageBlockTable.htm
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_column.htm
<apex:pageBlock title="test">
<apex:pageBlockTable value="{!workObj}" var="item">
<!-- below needs to be hyperlink -->
<apex:column value="{!item.name}" />
</apex:pageBlockTable>
</apex:pageBlock>
I could achieve my goal by throwing the good design away like below but I would like to keep the code above.
This works but no salesforce style is applied.
<apex:pageBlock title="my test title" >
<apex:dataTable value="{!workObj}" var="wn" cellpadding="2" cellspacing="2">
<apex:column>
<apex:facet name="header">仕事名一覧</apex:facet>
<apex:form >
<apex:commandLink value="{!wn.name}" />
</apex:form>
</apex:column>
</apex:dataTable>
</apex:pageBlock>
Instead of <apex:column value="{!item.name}" />, try doing it like this in the column body:
<apex:pageBlock title="test">
<apex:pageBlockTable value="{!workObj}" var="item">
<apex:column>
<apex:outputLink value="{!item.name}">{!item.name}</apex:outputLink>
</apex:column>
<apex:pageBlock title="test">
<apex:pageBlockTable value="{!workObj}" var="item">