Using the Microsoft.SharePoint dll, I can render SP Fields in custom application page using the below server side code.
BaseFieldControl editControl = field.FieldRenderingControl;
editControl.ID = field.Id.ToString()
editControl.ControlMode = SPControlMode.New;
editControl.ListId = list.ID;
editControl.FieldName = field.InternalName;
pnlFields.Controls.Add(editControl);
Now, we're converting our farm solutions to Addins/SPFx. I cannot find an equivalent of the above code via CSOM/JSOM. What is the way to render SP Fields in a custom page via client side programatically (Addins/SPFx) and How?
This will be used in a Batch Edit page, wherein the custom Batch Edit page contains the SP Fields visible in the default edit form of the list. And on the Batch Edit page, the user can input their updates to the items (just like entering inputs on the edit form).
You can't find it because a FieldRenderingControl does not exist in the SPFx world :)
I would highly recommend this sample to see how to dynamically render fields:
https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-list-form
It shows you how to read the list schema and render fields accordingly. You will have to render each field yourself, as well as handle any storing of data after an update. In the sample they have added code for most fieldtypes.
You can also batch these update calls (as you mention batch edit in your question) using the Microsoft graph:
https://learn.microsoft.com/en-us/graph/json-batching
This will save you a bunch of requests as you can do 20 item updates per call by using this.
Related
Tools: SharePoint 2013, SharePoint 2013 Designer, StratusForms
What I was doing: StratusForms - Modify SharePoint's Default Forms with HTML Templates (https://www.youtube.com/watch?v=oai-m_KyzMc)
Status: DispForm and EditForm currently work, NewForm did work until the incident.
Incident: I deleted the main webpart on NewForm and the form was hosed, so I deleted NewForm.aspx. I recreated the NewForm.aspx and also added it to forms library (https://sharepoint.stackexchange.com/questions/108467/accidentally-deleted-default-editform-aspx). Like before when it worked, I added a Content Editor webpart and pointed it to my StratusForms template, but it did not work . The controls/boxes did not show up. It worked before on the old NewForm, and it currently works on DispForm & EditForm.
Question: Given the above information does anyone know why, or better yet have a solution, to get NewForm.aspx working with StratusForms again?
Thank You!
So the underlying issue was SharePoints internal linkage of it's 3 forms (DispForm, EditForm, NewForm) to the data sources.
So those out-of-the-box forms are not like the ones we create. Even though you create a new "NewForm" and it may look like the old default NewForm, but it is not. There is metadata like Microsoft.SharePoint.PAGETYPE, which tells if it is a custom form or new, display, or edit form.
The resolution was found in this article (http://www.sharepointblogs.be/blogs/vandest/archive/2011/03/11/troubleshooting-issues-with-dispform-editform-and-newform.aspx).
In case the link breaks I have also included the manual method here:
Manually
It's easiest if you take a corresponding form from another SharePoint List in the site and export it (SharePoint Designer) or just copy it to a text editor. This way, most of the settings of the List Form Web Part are already correct
Generate a new GUID and fill that in for the __WebPartId [uppercase & just change a few chars/numbers] and properties [lowercase, same as WebPartID & has a g_ prefix] of the List Form Web Part markup. It has to be the same GUID but the formatting is different. See the above screens for samples
Update the property with the List ID you're targeting
Verify all other properties of the List Form Web Part and save the file as either DispForm.aspx, EditForm.aspx or NewForm.aspx
Import (SharePoint Designer) the page (or paste contents from the text editor)
So i was trying to add title tag for all my images in Sitecore.
John West had a solution here
The issue is, I am not getting all the rendering fields in my pipeline. When i debug the Solution, the breakpoints hits only 4 or 5 times totally and they are all different fields either under footer. Interestingly all of them are only "Rich text" Fields. What am i missing? Why am i not getting all the fields under Sitecore.Pipelines.Renderfield.RenderFieldArgs?
I am also using Glassmapper and using #RenderImage to render the images. Couldthat be the reason?
GlasMapper does not run through the RenderField pipeline in Normal mode (it does in edit mode), this issue has been raised before as an issue on Github for String field types.
You can either force it through the pipeline by creating a custom html helper extension which works in much the same way as Glass does in Edit mode.
Or alternatively I'd suggest creating a custom Glass Mapper Data Handler inheriting from SitecoreFieldImageMapper and then overriding the MapToImage methods. Use that as the type for your property or replacing out/insert before the existing mapper registrations in DataMapperConfigFactory.
I am trying to implement a Chart Block in Wagtail where a user can upload a spreadsheet via the DocumentChooserPanel and then a chart is generated based on the data in that spreadsheet.
I currently have it functioning, but the user must explicitly specify the variable they want the chart to be based off of:
class ChartBlock(blocks.StructBlock):
data_file = DocumentChooserBlock()
primary_variable = blocks.CharBlock(required=True,max_length=255)
class Meta:
template = 'dataviz/blocks/Chart.html'
icon = 'cogs'
label = 'Chart'
I was wondering if there is any way to have the primary_variable field dynamically populated with the column headers from the spreadsheet uploaded and stored in Documents - so that the user would be able to choose from a list of available variables instead of having to remember what a variable was called.
Thank you so much!
This wouldn't be easy to achieve with a vanilla implementation of Wagtail.
The page edit form is generated on page load, including the population of choice lists. I'm pretty sure that the same is true of choice lists in StreamField blocks, that they are populated as the block is added.
The code for this hangs between wagtailadmin.edit_handlers, wagtailadmin.views.pages and wagtailcore.blocks. It would be a pretty complex customisation.
Another possible route for investigation would be using the insert_editor_js hook to update the primary_variable field once a document was uploaded. However, I'm not sure you'll find a dependable ID to hang an event listener off of.
However, you will soon be able to custom validate the submitted page. A PR has just been submitted to allow this custom validation. That should reduce the amount of user error when adding the primary_variable.
This feature should be available in Wagtail 1.4, which I believe is due for release pretty soon.
I hope that helps.
I am making an application in Ember which would do the functionalists.
Allowing the user to upload an Image and then crop or zoom it. (The values associated with the image I am storing into a model using Fixture Adapter as I don't want the data to be persistent).
I am allowing the user to write some message and also change the font-size, color of the text. (Again I am storing it in the same way.)
I am adding recipients. (Again I am storing them the same way)
Now I want to get a list of previous recipients from the server which will then be shown to the user so that he can add or select previous recipients.
Now the problem is I want to get recipient list and store it in some kind of model. But I am not getting how to do that. I am thinking of making another model for previous recipients and display the list from there. But is it possible to get the values of different model and show it in different view?
Looking forward to hear different views.
We have a form with a dynamic running totals table beneath the form. For example, when a user changes a value in the Quantity field, the running totals update based on the input (via javascript). The table is displayed only, nothing is saved in the database
We want to be able to generate a pdf that includes the updated running totals. Basically I'm searching if there is some way to pass the current innerHTML within a div to a pdf.
This may have been already asked and answered here- Generate pdf from current document , but the user didn't specifically say that the form updates data after the initial page load. So I just want to be sure I'm not missing something. Thanks. I have a feeling I should look into localStorage for this.
(From the comments)
I think you may be over-complicating the PDF functionality. It is not necessary to keep up with the local changes that the users make as far as generating a PDF is concerned. Most likely the users will make whatever changes to the page and then click a link/button to generate a PDF only after completing all of the changes. At that point you could simply submit a form with all of the updated values to ColdFusion and generate your PDF file. Instead of/or in conjunction with updating the innerHTML of a div, update the hidden form fields as well. Then on the ColdFusion server you could use something like the CFDocument tag to create your PDF from the form fields that were submitted. (Remember to validate all of the form field data before using it.)