I have a list a and want to use (CSR) Jslink to change the view but multiple fields
I have a list but want to use CSR - jslink to change the view of multiple fields. Can a jslink have multiple fields to change. Looking at the samples
here
Would like to merge 2 or 3 script in one to do multiple things. Is this a best practice?
Thanks in Advance
Code snippet here below(tried this but not working for me.Sure im missing something): Trying to combine the prioritycolor and percentagecomplete together but not working
// Create object that have the context information about the field that we want to change it's output render
var fieldsContext= {};
fieldsContext.Templates = {};
fieldsContext.Templates.Fields = {
// Apply the new rendering for Priority field on List View
"Priority": { "View": priorityFiledTemplate },
"PercentComplete": {
"View": percentCompleteViewFiledTemplate,
"DisplayForm": percentCompleteViewFiledTemplate,
"NewForm": percentCompleteEditFiledTemplate,
"EditForm": percentCompleteEditFiledTemplate
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(fieldsContext);
// This function provides the rendering logic for list view
function priorityFiledTemplate(ctx) {
var priority = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
// Return html element with appropriate color based on priority value
switch (priority) {
case "(1) High":
return "<span style='color :#f00'>" + priority + "</span>";
break;
case "(2) Normal":
return "<span style='color :#ff6a00'>" + priority + "</span>";
break;
case "(3) Low":
return "<span style='color :#cab023'>" + priority + "</span>";
// This function provides the rendering logic for View and Display form
function percentCompleteViewFiledTemplate(ctx) {
var percentComplete = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
return "<div style='background-color: #e5e5e5; width: 100px; display:inline-block;'> \
<div style='width: " + percentComplete.replace(/\s+/g, '') + "; background-color: #0094ff;'> \
</div></div> " + percentComplete;
// This function provides the rendering logic for New and Edit forms
function percentCompleteEditFiledTemplate(ctx) {
var formCtx = SPClientTemplates.Utility.GetFormContextForCurrentField(ctx);
// Register a callback just before submit.
formCtx.registerGetValueCallback(formCtx.fieldName, function () {
return document.getElementById('inpPercentComplete').value;
return "<input type='range' id='inpPercentComplete' name='inpPercentComplete' min='0' max='100' \
oninput='outPercentComplete.value=inpPercentComplete.value' value='" + formCtx.fieldValue + "' /> \
<output name='outPercentComplete' for='inpPercentComplete' >" + formCtx.fieldValue + "</output>%";
Hi Patrick,
It works in my test environment using your code.
I suggest follow the steps as below:
1. Save the following code as a js file (TaskListView.js) and upload it into the SiteAssets Document Library.
2. Edit the list view page.
3. Edit the list web part. Go to Miscellaneous -> JS Link.
4. Add the following URL into the JS Link textbox.
~site/SiteAssets/TaskListView.js
5. Click "OK" and save the page.
If it still not works, please check whether active the Minimal Download Strategy feature in site feature or not.
Best Regards
Dennis Guo
TechNet Community Support
Similar Messages
-
Hello I got an Iphone 4 today. The guy set it up for me in the shop and i couldnt remember my apple password so i set up phone using my work email. However I have given him the incorrect one and now at home cannot access the apps or itunes as I cannot verify my apple id. Can i now change it on my phone to the one i use at home? I have worked out how to change it on the computer but dont know were to change it on my phone is it possible? Help.... sal
when you open the app store scroll down to the bottom it will display the apple id currently in use, change it to your normal apple id email
-
I have a mac osx and want to use a magic jack without the computer on all the time.
I am trying to use a magic jack plus without plugging into my mac. (It will work plugged directly into the computer but I bought it so I would not have to keep my mac on all the time to use the phone).
What do I need to get a separate modem. I am on air port express (an old one)It appears that Magic Jack installs software on your system that it needs to run. Look at some of the threads in "More Like This" on the righthand side of this page or look here:
http://www.voipreview.org/review/magicjack -
I have an iPod mini, 6 GB and want to use it with a Sony CD Boombox but the adapter is different. Can it still work? Don't want to try and break iPod.
Do you mean that the iPod mini won't fit on the "dock" because of shape (of the iPod), or is the docking connection a different type from the "30-pin" dock connector on the iPod mini?
-
I HAVE AN IPHONE 5S AND WANT TO USE SOFTWARE 7.0.2 BECAUSE IT IS COMPATIBLE WITH MY VEHICLE FOR UCONNECT. I CURRENTLY HAVE SOFTWARE 7.0.3 ON MY DEVICE. HOW WOULD I GET THE PREVIOUS SOFTWARE BACK ON MY PHONE
Forum Tip: It is generally considered inappropriate to type all in uppercase letters in Internet discussions, as text that is typed all in uppercase is by convention considered to be shouting. Uppercase is also more difficult to read, so please use all uppercase sparingly and only when you really mean to shout, which we hope you won’t need to do here .
Regards. -
I have a new iMac and want to use my HP 7300 "All in One and cannot use the fax feature because there is no phone port is there a solution for this?BACellli
You don't need a phone port on the iMac. The HP 7300 DeskJet Pro has an internal modem, you connect the printer's modem connection directly to your phone line. Please re-read the install directions that came with the printer.
-
I have an old MACBook and want to use it as an external drive to load disks on to my new mac. How do I?
Apple makes a Thunderbolt to Firewire adaptor if your new computer does not have a Firewire port.
-
I have an older HP connected to the usb port of my Time Machine, and have it shared. I want to print from my iPhone on the network, but it can not be found in airport? How do I make this work?
AirPrint printers connected to the USB port of the Apple AirPort Base Station or Time Capsules are not supported with AirPrint.
Read through this for information about Airprint printers and how to use them:
http://support.apple.com/kb/ht4356 -
I had iMessage with a UK number and I have moved to Australia and want to use an Australian number, how can I change it over?
something here may help
http://support.apple.com/kb/TS4268 -
Hi there
Hope someone can help me here. I am currently on holidays and my
Kids have disabled my iPad so I now have to sync with my computer.
I don't have my computer handy and want to use my device over the next few weeks
if possible so can anyone help me please
Thanks
Darren
iPad 2 Wi-Fi + 3G, iOS 6.0.2You need a computer.
Suggest you goto the nearest Apple Reseller and ask them to help you. -
I have old photoshop 6 and want to use Warp...can I do that?
I have old photoshop 6 and want to use Warp...can I do that?
If I understand correctly holders of licenses of older versions than CS2 are entitled to install and use Photoshop CS2.
Maybe you could read up on that and, in case you want to pursue that option, make sure your OS and Photoshop CS2 »play nice«.
http://helpx.adobe.com/x-productkb/policy-pricing/creative-suite-2-activation-end-life.htm l -
I have just brought a preowned iPad mini which had the prev persons apple Id details still in, I have my own I'd from my iPad I want to use. how do I change the prev persons details to enable me to use my details
You should configure the ipad to factory settings and set up as 'new'
settings/general/reset/erase all content and settings -
i have an ipod touch and it is disabled cause my cousin changed the password and forgot what it is so now it is stuck .. i connected it to the itunes but still the keypad didnt appear and couldnt remember the password.. anyone can help me ?
Place the iPod in Recovery Mode and restore via iTunes.
iOS: Wrong passcode results in red disabled screen
If not successful, try DFU mode.
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings -
My iTunes library is on an external hard drive, and I was able to access / add to the library from my windows laptop.
I now have a new laptop, and want to be able to KEEP the library on the external drive while being able to use iTunes from the new laptop.
I have selected "choose library" in iTunes, and have chosen the iTunes Library.itl file on the external drive.
My media populates in iTunes on the new laptop version of iTunes, but when I click on a song iTunes says that it cannot locate the song.
Your help is kindly appreciated!Thanks. Were the settings shown in your last screenshot in force when you added the song that's shown on being on the C: drive? It is also possible that at some point you ran iTunes with the external drive disconnected, in which case it will have defaulted to the library on the C: drive, or that you've run iTunes without explicitly selecting the library on the E: drive. To make sure the latter is the case, hold down SHIFT while starting iTunes, then when you get this prompt:
click on Choose Library..., navigate to the location of your current iTunes Library.itl file, and click Open.
Part of your issue may that its not obvious where that current database file is located. The folder layout on your E: drive isn't the one that's most easily managed - so its possible that the database file could be in:
E:\xxxx\Files\iTunes
E:\xxxx\Files\iTunes\iTunes
E:\xxxx\Files\iTunes\iTunes 1
I suggest that a lot of your issues can be addressed by reshaping your library into the reliable "portable" layout as described in tt2's Make a split library portable user tip. Comparing your screenshot with the equivalent on my system (where I have a "well-formed" library on an external drive):
where:
there is just one iTunes folder with everything used by iTunes inside it
all media is held within subfolders of the iTunes Media folder
The way you have yours set up, where the iTunes Media Folder location is set to E:\xxxx\Files\iTunes rather than E:\xxxx\Files\iTunes\iTunes Media is probably why some of your media is not being located correctly - the extent to which iTunes can correctly resolve locations is, to an extent, reliant on the folders for the different media kinds (Music, Audiobooks, etc.) being inside the iTunes Media media folder. One common misunderstanding (not helped at all by Apple's documentation!) is that the iTunes Media Folder location setting in Edit > Preferences > Advanced does not tell iTunes where to find anything; rather it determines where iTunes will put new additions to your Library, in conjunction with the Copy files to iTunes Media folder ... flag:
I would definitely take the time to work through the steps to bring your library into the "portable" shape - there may be few remaining issues with broken links when that's complete but this will be much easier to fix if your library is in a more standard structure. -
I have lost my iphone 4s and want to use find my iphone app on my boyfriends iphone 3s to delete the info on my now lost phone. Do i need to log out of his icloud inorder to log into mine to do this on his phone?
You need to use the Find My iPhone app (in the itunes store - free). When invoking it on a device, you enter the ID password of the account the lost device is connected to. You can also use a computer's browser and log into icloud.com.
Maybe you are looking for
-
Require password to wake from sleep is broken
Recently, the security setting "Require password to wake this computer from sleep or screen saver" stopped working for me. Seems like it was around 10.4.6. Now, whenever my mac is asleep or in SS, just moving the mouse gets me back to log in. I have
-
Any advice? Hoping I can bring it into the apple store to have looked at? Anyone with similar experience?
-
Price for 2nd material to be copied from 1st material
Hi Experts, We have some unique requirement. My client is into service business. Most of our sales documents will be with one material for which price is determined from the condition records. In few scenarios the cusotmer will also go for ad
-
do i use the StringInputStream class when i want to get a string from the inputstream? eg. Socket skt; InputStream input; StringInputStream sInput; //get string input stream from socket input = skt.getInputStream(); sInput = new StringInputStream(inp
-
Hi all, We are running NW2004s SR2 on our Solution Manager system. We upgraded component ST-SER to 700_2008_1. The older SMD agent appears to not work correctly with this level according to SAP. My question is, is it possible to install the standal