Sharepoint Framework Property Pane - building a dynamic property - javascript

I'm attempting to build a dynamic property in the Property Pane of a React based Sharepoint Online Web Part.
In order to achieve this I wish to iterate through an array of data in the PP, to create multiple drop down fields. Currently I can only create drop down fields through individual variables, not arrays or objects (as these can not be iterated through in the PP render method). This means that I can only render a predefined number of drop down fields in the PP.
Microsoft have already achieved this functionality on their 'Highlighted Content' Web Part, but haven't published the source code for this, so I cannot see how they have achieved it. On this Web Part the user can add multiple PP drop down fields and remove these individually too, without limit (i.e. they are rendered fully dynamically).
Is this possible to do or am I taking the wrong approach?
[![MS Highlighted Content Web Part][1]][1]

Related

How to do a person search and return back those lines in a select group of spreadsheets in a SharePoint document library

I have a need for a user to type in a name of a user on a SharePoint page and have it only look for all occurrences of this name in a series of spreadsheets stored in a single document library. This should return a series of lines where this person's name found.
A few things.
- The names used in the spreadsheets are not exact matches to those in
SharePoint and in fact will be first last instead of last, First as
in SharePoint. Maybe only accepting last names?
- These spreadsheets do have a property called Deliverable set to RACI.
- The spreadsheet lines look like this: Sponsor,DHS,Krista Willing,A,A,A,R,A,A,A
I have started the design and my first web part is a list filter allowing the user to pick a name. I then want to take the last name of what is selected and do a search in a document library for all the RACI (excel documents with RACI as a property) and display the results. This last part I'm still trying to figure out.
We can implement this using customizing the display template and content search webpart, please refer the below link how to customize the display template :
Content By Search Web Part
Content By Search Web Part(CSWP) was introduced in SharePoint 2013. CSWP has power to display dynamic content from SharePoint search index, based on dynamic search queries. It uses Display Templates for styling and formatting search results on the page. A big advantage of using CSWP over CQWP is, there are no scope boundaries for getting data across sites. However freshness of results depends on the latest crawl on content.
Display Templates 
Display Templates are used with CSWP to format/style search result generated by CSWP search query. Display Templates control which managed property is shown in the search results and how they appear in the Web Part. Each Display Template has two files: an HTML version of the Display Template that you can edit in your HTML editor, and a .js file that is for SharePoint use and should never be modified. CSWP uses combination of two Display Templates, Control Templates and Item Templates to render results.                         
Control Template provides HTML to structure the overall layout for how you want to present the search results.For example, the Control Template might provide the HTML for a heading, beginning and end of a list. The Control Template is rendered only once in the Web Part.
Item Template provides HTML that determines how each item in the result set is displayed. For example, the Item Display Template might provide the HTML for a list item that contains a picture, three lines of text that are mapped to different managed properties associated with the item. The Item Display Template is rendered one time for each item in the result set. So, if the result set contains ten items, the Item Display Template creates its section of HTML ten times. 
https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/84/8233.figure2.jpg
There will be two display templates
Header or control Display template
Item Display template
We need to customize the item display template. Process is - download the default item display template from display template gallery, rename the file name, do the customization, upload back the customized display template, publish it, go to content search web part, from web part setting select the newly updated item display template.
Sample item display template code :
<mso:ManagedPropertyMapping msdt:dt="string">'Picture URL'{Picture URL}:'PublishingImage;PictureURL;PictureThumbnailURL','Link URL'{Link URL}:'Path','Line 1'{Line 1}:'Title','Line 2'{Line 2}:'Description','Line 3'{Line 3}:'','SecondaryFileExtension','ContentTypeId', 'FileExtension'{FileExtension}:'FileExtension
https://blogs.technet.microsoft.com/sharepoint_quick_reads/2013/08/01/sharepoint-2013-customize-display-template-for-content-by-search-web-part-cswp-part-1/

Solution to raise the amount of products( quotedetails or quoteproducts) in Quote entity via modal

I want to add a Button in the ribbon of Quote,
When the user clicks on that, A modal displays, with two fields.
One is quote product categories that exist in that quote, that means it searches in quote product of the quote and find all the categories exist in that specific quote and then display them in a combo box. with their guid or something like that.
Another field is a textbox, which is percentage.
something like .
The end-user clicks on the ribbon button, the modal appears, he/she gives a number to the percentage and select one of the categories; when presses apply button, it find and return all amounts of the quote products in that quote that matches the user selected category, compute some amount based on quote total amount and the returned amounts and and insert that computed number into a field in each quote product named overed_amount.
How can I handle this? JS or Plugin?
I prefer to this via JS rather than writing plugin, But can I pass parameters between this HTML or JS file to CRM Form/Forms?
And does anybody have any sample? like this? any suggestion?
I googled and most of Plugins are about writing simple plugin based on existing code.
Can I display modal via plugin? Any suggestion or advise? or sample?
Plugins (and custom workflow assemblies) run as part of the backend platform. The only "UI" component they have is they run synchronously and throws an Exception, a popup will show that Exception to the user.
The typical way to add custom UI components is via custom web resources.
In custom web resources you can do HTML / JS / CSS, and even leverage 3rd party libraries such as KendoUI. You can add them to the form or open them via a ribbon button.
A custom web resource can typically interact with the main Dynamics 365 form via the parent property (as the above linked article describes).
One library that can help with displaying custom web resources in D365 is Alert.js, though as the documentation says, it's unsupported.
If you want to include some backend operations as part of the custom UI, you can create custom actions and call them from the custom web resource's JavaScript.

How to implement a Tag Bar in javascript / css

I'm trying to implement a search bar for a web page having basically the same properties of the Tag bar appearing when you ask questions on Stack overflow:
It should have the following properties:
Allow the user to directly type in it.
Pull up entries with same letters as the user is typing.
Allow to delete an entry by either deleting on keyboard or pressing on inserted elements.
I'm interested in understanding the underlying structure of such an element and how to setup listeners and functions that call each other, not simply the code. Could anyone please help me figure out the skeleton of the functions I need to implement?
Besides just using a jQuery UI plugin, the simplest way to do it would be with a text input box and a ul. You can use jQuery (or something else depending on if you are using a framework) to listen to any change in the input box.
At that point you have a choice depending on the rest of your app: The filtering can happen in the front end or the backend. Because databases tend to be fairly quick, it might make sense to filter within it if you have a very large set of data. Otherwise, you could just grab the entire list and use JS to filter it.
Either way, have a callback occur on that change that initiates the filtering and then renders the results into the ul.

Is it considered bad practice to store and retrieve information only from the DOM?

Say I have a dictionary website, and in one div, I display the word, its definition and an example. I need to refer to those strings somewhere else. Is it generally acceptable to just pull them out of the div (find element by Id, get value), or is it better to create an object representing everything in that div, and avoid the DOM when I need to query its values?
Further Explanation: Someone can click on an element on the page (the element just displays the word), and in another div, it displays the definition and example of that word(the element is associated with an object that contains all of this information). In that other div, there are textareas which display the definition and example. I want someone to be able to edit the text there, and for it to then update the values in the word object. Should I just get the text from those textareas and send it to the word object, or should I have an "edit div" object, containing the strings in the text areas, and just send the values between the two objects?
The approach you describe would quickly become hard to maintain and test. I imagine if you had a dictionary site you'd have a backend containing all the words. You'd need to use JavaScript to get that data - so you'd probably bind your UI to the data retrieved from that backend and the JS objects would be the place that everything else gets looked up from.
This approach disconnects your UI from the underlying data and doesn't create a mangled mess of UI referring to other UI.
I'd recommend reading about how to use a single page app framework such as AngularJS, DurandalJS or EmberJS in order to structure things 'correctly'.

Applying Choices in Fields using View in Lotus Domino Web application

I can't quite figure out a work around for using "Use view dialog for choices" in a web based application.
My Question is how can i convert this settings in my field in the Control Tab then Choices, in choices "Use view dialog for choices" then Use current database and access view and a specific column.
Thanks in advance :)
"Use view dialog for choices" is almost always a way to get around the restrictions on the return value of a formula. For instance, you'd use it when #DbColumn in a choices formula for a listbox or dialog list choices formula would cause an error.
The upshot of that is that there's no "one-shot" workaround for the web. A direct functional replacement would be to open the view in a pop-up window or overlay div, and attach some JavaScript to the view in order to override the default web behaviour and force the return of values to a field on the main document. This approach will work well, but it may require server settings that allow the entire view to be served at once (the maximum lines to display per page will probably be less than you need), and it's subject to breakage if the HTML used to display the view ever changes.
You can use LotusScript or Java in a WebQueryOpen agent to populate a conventional widget (the list of a element) in a Rich Text field, either using PassThru HTML or a "Treat contents as HTML" form. That would involve getting the view, then doing a document-by-document (or category-by-category) run through the view index to get the column values you need. (If you take this approach, use the ColumnValues rather than the document field name to retrieve the values -- the cost of opening the document to read the values is high, and your code will take many times longer to run.)
You can also get the view as need using an AJAX request and a ?ReadViewEntries query, which will return an XML representation of the view. Again, you may have to have the maximum view lines per page limit upped in order to get the amount of data you need. You can get around that, though, by using a "suggest" method that doesn't begin retrieving data until the user enters at least one character into the field.
All of these approaches mean using a separate form for the web. That's easy enough -- you simply create a form with the same alias (or name, if you're not using aliases) as the one you're using for the Notes client. In the list of forms in Designer, you can use the hidewhen tab to hide one from the Notes client and the other from the web. (Note that you can create an additional form for mobile devices the same way if necessary.)
I can't get more specific than this with the information at hand. If this is insufficient to point you in the right direction, then edit your question to be more specific (and post a comment to this reply -- I don't spend a lot of time on SO, but I do spend time on other StackExchange sites, so I'll be notified).
Unfortunately, you have to develop it yourself.
http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=AJAX%20Name%20Picker
AJAX-based name picker is a good start I guess.

Categories

Resources