Dynamically change TEXT of Tab Item - acumatica

How we can change the text of the TAB Item dynamically based on Order Type in Sales order screen.
for example: for TR order type, I want to change Document Details to Transfer Details.

To my knowledge there is no DAC binding for changing Tab Header Text from the business logic layer (graph). A possible workaround if you have a limited number of alternative Tab Header Text could be to create a tab for each of them and dynamically hide them based on your display condition.
How to hide Tabs in Acumatica:
Hiding a tab from the user interface dynamically
The other option would be to use JavaScript to change the inner element of the Tab Header Control.
Both options are less than ideal and can have an impact if you're looking to have your customization certified by Acumatica but if it's a hard requirement that's the only ways to do it that I'm aware of.
In the following example I'm using the hardcoded HTML Control ID for the Tab Header Control that I looked up using the Inspect Element feature provided by HTML browsers:
<asp:Content ID="cont1" ContentPlaceHolderID="phDS" Runat="Server">
<script type="text/javascript">
$(function() {
$(document)
.ready(function() {
document.getElementById("ctl00_phG_tab_tab0").innerHTML = "My Tab Header Text";
});
});
</script>
[...]
</asp:Content>

Related

Kentico 9 search result transformation

We've noticed a bug when looking at French search results. in the CMS Desk, i've kept the Page Name in English for the French content. The issue is, these are showing on the French results page.
in the transformation, based off the default one, I present the clickable title like this:
<a href='<%# SearchResultUrl() %>' data-type="title" target="_blank" ><%#SearchHighlight(HTMLHelper.HTMLEncode(CMS.ExtendedControls.ControlsHelper.RemoveDynamicControls(DataHelper.GetNotEmpty(Eval("Title"), ""))), "<span class='highLight'>", "</span>")%></a>
Here's my thinking, if the Menu Caption is filled out, use that rather than title. How do i output DocumentMenuCaption without adjust the search fields on the menu page type?
I think my logic is, check if DocumentMenuCaption is emtpy, if it use, use Title.
You should be able to continue using GetNotEmpty and just pass in the DocumentMenuCaption first, something like this:
<%# GetNotEmpty(GetSearchValue("DocumentMenuCaption");Eval("Title")) %>
You may or may not need the "GetSearchValue" function, but that allows you to grab values from the object that may not be available in the default set of columns for the search results.
Alternatively, you should be able to use the IfEmpty() method:
<%# IfEmpty(GetSearchValue("DocumentMenuCaption"), Eval("Title"), GetSearchValue("DocumentMenuCaption")) %>
Both transformation methods taken from here (double check syntax on "GetNotEmpty" as there are different ways it's implemented: https://docs.kentico.com/k9/developing-websites/loading-and-displaying-data-on-websites/writing-transformations/reference-transformation-methods
You can read more about the search transformations here: https://docs.kentico.com/k9/configuring-kentico/setting-up-search-on-your-website/displaying-search-results-using-transformations

How to change teamsite text layout programmatically?

I have a code that creates a teamsite. After that I add some web parts to wiki web part zone(rich content area). In SharePoint 2010 user can change a text layout of the rich content in page edit mode.
Is there any way to programmatically change the text layout of the rich text area? I would want to set "two columns with header"-layout after site creation has completed.
My site is created like this.
site = elevatedSite.SelfServiceCreateSite(params.....);
rootWeb = site.RootWeb;
rootWeb.ApplyWebTemplate("STS#0");
SPListItem currentItem = rootWeb.Item;
var xhtml = currentItem[SPBuiltInFieldId.WikiField] as string;
Now I can modify the xhtml string and save it back to the page. I have tried to change it so that it contains exatly the same html structure which have created by sharepoint itself, when changing the text layout. After that change, actually it is not recognized as "two columns with header"-layout in sharepoint. It is still default one-column layout. Is there anybody who knows is it possible to change the text layout of the rich text area programmatically?
I found answer from here http://donalconlon.wordpress.com/2010/05/04/sp2010-creating-a-wiki-page-using-the-om/. SharePoint stores the information about used layout to the hidden span-element in wiki page.
For example, this presents two column layout without the header or footer.
<span id="layoutsData" style="display: none">false,false,2</span>
first false = no header
second false = no footer
2 = two columns
I have been looking for some information on doing the same thing. I found this blog post that checks out the page, edits the content then publish and approves it.
SharePoint 2010 change page content data through Object Model / API – Console Application
If you need to modify pure HTML content, its better to use cutom IHttpHandler (wrapped in dll) and connect it to SharePoint via web.config. Is is also allowing to modify dynamic content like AJAX responses.

setting width of column - sharepoint

I have a sharepoint list and the phone number field is in the format ###-###-#### and it ends up going to 2 lines. How can I set a width on that particular column? Do I need to do it from sharepoint designer?
there is no way to do this out of the box. Have to use sharepoint designer or jquery. Check out this msdn post
http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f99303bb-6a95-4c05-951c-ff0185c4e864
This can be done via the xsltlistform webpart. drop it into the page in sharepoint and connect it to your list and move the columns around as needed.
Note: this is not the same as modifying the view, which as titan said is not available out of the box without opening the view page in sharepoint designer and modifying the xslt directly.
Best way is to use Alt+0160 Hard Space. Just type it once and copy this "Space" and paste as many you want!! Bingo!!
In SharePoint Designer 2010 I was able to modify column widths by opening the view I wanted to adjust, then lengthening the with of the column Title Field simply by dragging the field's box bigger.
This worked for what I was doing, but I noticed with some columns it affected others, I guess because they shared the same styling? I don't know enough to be certain.
<style>
/* new class created */
.ms-longg
{
width:500px
}
</style>
<script type="text/javascript">
$(document).ready(function(){
//removed existing class
$('input[title^="State"]').removeClass('ms-long');
//add New class for that textbox
$('input[title^="State"]').addClass('ms-longg');
});
</script>
Click here see more details
you can also use the below script to expand the width of specific column. Just edit the page then add script editor web part and add below code.
note: the column name is the internal name.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js">/script>
<script language="javascript" type="text/javascript">
jQuery(document).ready(function() {
var el = document.getElementsByName("<internal column name>");
el[0].style.width ="<size>";
});
</script>

Is it possible to format a NumberField in a page layout?

I'm developing a SharePoint publishing site and setting up its content types and page layouts. I need to display the value for a Year field with type Number. The markup currently is:
<SharePointWebControls:NumberField FieldName="Year" runat="server" id="Year" />
The problem with the default behaviour is that it shows each number with a comma, e.g. "2,009" instead of "2009". Is there a way I can set some sort of String.Format syntax on the field to make it display correctly?
I tried creating a new rendering template which looks like this:
<SharePoint:RenderingTemplate ID="YearNumberField" runat="server">
<Template>
<SharePoint:FormField ID="TextField" runat="server"/>
</Template>
</SharePoint:RenderingTemplate>
... but there doesn't appear to be any 'Format' property on the FormField object.
Thanks for any help.
Update:
I tried wrapping the SharePoint:FormField tag inside SharePoint:FormattedString. Unfortunately the field was not formatted, same results as this question.
The issue is that the rendering template must use FormField. This always renders the value in the format: 1,989 . To resolve this the rendered text needs to be trapped and altered to get the desired output. Here are two approaches to resolving this:
1. Write a custom control inherited from NumberField
The RenderFieldForDisplay and RenderFieldForInput methods can be overridden to provide the desired output. Additional properties can be added to the control to describe additional behaviour.
Pros: No changes to rendering templates required.
2. Write a custom control for use in the rendering template
A control that (for example) uses regular expressions to alter text can wrap around the FormField control.
<SharePoint:RenderingTemplate ID="YearField" runat="server">
<Template>
<RX:RegexManipulatorControl runat="server"
Mode="Replace"
Expression=","
Replacement="">
<SharePoint:FormField runat="server"/>
</RX:RegexManipulatorControl>
</Template>
</SharePoint:RenderingTemplate>
Pros: Generic solution can be used for any type of field.
from Just Another SharePoint Blog
Open the list view in SharePoint
Designer.
Right click on the data view web part.
(the list)
Select Convert to XSLT Data View
Click on the number field you would
like to format
A > will appear showing Data Field,
Format As
Click on the link below Format As -
Number formatting options
Under Options deselect Use 1000
separator
Click OK
Save your changes and hit F12 to
preview

Customize SharePoint:FormFields to a specific height

I'm customizing a NewForm.aspx page and I've created a few new SharePoint:FormFields in the form of textboxes. I'm looking to customize the height of these boxes on a case-by-case basis, but I can't figure it out.
I've looked into DisplaySize, but that only controls the width of a specific textboxe, and I've seen adding in:
<style>
.ms-long{width:100px;}
</style>
but that changes every SharePoint:FormField size, not just one.
Find the element in the complete html output, and use the id rather than the class as the css selector. If you can't find a suitable selector or you need to use selectors not supported in ie, you can use javascript/jquery to find and modify individual controls.
If you are customizing the NewForm.aspx, and you want to customize the look of the controls, you should also customize the CSS by using your own .css file. That may or may not include a customized master page.
I take it your a user of SharePoint Designer to be editing NewForm.aspx. Personally the route I would go down is to design a custom text box field and give it the desired size that way. Might not be what you want, but it's one way to do it.

Resources