javascript event when a row is updated/changed in a Datasheet view?
-
05-10-2020 - |
Question
Is there any way to catch update/changes in the Datasheet view of a list in JavaScript in SharePoint 2010? I see their are event receivers but nothing in Javascript.
La solution
The datasheet view was renamed to quick edit in SP2013, removing the ActiveX dependencies and migrating the implementation to html / js.
There is almost no documentation about what you are trying to achieve, but I would give a try to spjeff implementation, who overrides the template implementation:
http://www.spjeff.com/2014/05/17/quick-edit-supports-js-link-and-client-side-rendering/
Autres conseils
Note:
in June 2017, Microsoft disabled the use of JavaScript in a Calculated Column
That means given answers may not apply for newer SharePoint versions
For long explanation and work arounds see:
June 13th 2017 Microsoft blocked handling HTML markup in SharePoint calculated fields - how to get the same functionality back
Original answer: http://www.viewmaster365.com/#/Create/SearchFilter
This kinda weird looking code in a Calculated Column set to datatype is Number will attach a KeyUp event to a DOM element above the search box, that way catching each keyup event. If you attach it to each TR (TableRow leave out the 3 parentNodes), it should work in a Datasheet View as well.
=" <img src=""_layouts/images/blank.gif"" onload=""{"
& "var TR=this;while(TR.tagName!='TR'){TR=TR.parentNode}"
& "TR.parentNode.parentNode.parentNode.addEventListener('keyup',"
& "(function(keyevent){"
& "this.style.backgroundColor='"
& [Task Name] & "'.indexOf(keyevent.srcElement.value)===-1"
& "?'lightcoral':'lightgreen'"
& "})"
& ".bind(TR))"
& "}"">"
ICC