0

I have a new item form (masterdata) which should have several sub items that are stored in another list. The sub items should be entered using grid view and linked to ne newly created item.

My approach is to create a guid on the new form and fill it in a hidden field of the new form. Then also add this guid to every item that is added to the grid view in the same manner.

The first part works fine. I created a jslink for the second part, that updates the values and it is displayed correctly. But if I enter the guid field its empty - and so is the data saved for the field.

The GUID gets populated (and its also in the js object) The GUID gets populated (and its also in the js object)

But as soon as I click on the field it shows the "real" value which is empty But as soon as I click on the field it shows the "real" value which is empty

Looking through the web I found this reference where someone said it would not be possible to set values with code because of the way jsgrid works.

But I also found this example on how to modify and enhance the jsgrid. As far as my understanding is, with a little effort it should be possible to modify the jsgrid to be able to change the values in the grid with javascript.

Sadly I am not so deep in developing that I knew how to do it - hopefully someone with more skills in this area could help me? Maybe just a kickstart, so I can do the rest for myself.

1
  • 2
    I've uploaded the whole source file a while back: sharepointbitsandbytes.com/wp-content/uploads/2014/01/… It's not the newest version, though, but it should work. The function that you want to look into is editorInstance.SetValue = function (value) {}, then you check whether the grid is in edit mode if (cellContext.inGridMode === true) and you set the value. Ignore the rest of the code in that function as it only checks if the user has permissions to edit the value. Hope this helps. Commented Mar 27, 2017 at 13:08

1 Answer 1

1

There is no corner to cut, the example you linked to is the way to get into that QuickEdit control..

But you will be adventuring into Microsoft JavaScript code hardly anyone understands anymore (QuickEdit was there in 2003 , maybe even 2001).

In the Modern Experiences they re-used the code (we could tell because UserCustomActions disabled everywhere still worked in QuickEdit)
but they recently removed that code as well. So it looks like they are re-building everything with SPFx code.

For Classic SharePoint, Microsof will, like many technologies, have the approach

It worked for 10 or 15+ years... Don't touch it!

Also note that your JSLink knowledge (or CSR as its actually called) currently has no future in the Modern Experiences.. they are now working on something called "Code Parts" and will most likely put restrictions in what you can do with JavaScript in a webPart or Page
They tried to sell it to me as "We will protect you from making (javascript) mistakes"

1
  • Well, as far as my understanding is, the quick edit as ajax/CSR solution was introduced in SP 2013. Before that it was always an active x control? Well, eventually I have to fiddle it out myself on how to modify the example :(
    – fuetty
    Commented Feb 22, 2017 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.