質問

これは本当に非常に簡単かもしれません、私は複数のリッチテキストフィールドを持つリストビューを持っています、私は特定のビューのフィールドからHTMLフォーマットを削除し、それらをプレーンテキストとして返します。

正規表現を使わずにやりたいです。私は簡単な方法がなければならないと確信しています。 任意の提案?

役に立ちましたか?

解決

それは私が思ったほど簡単でした。同じ... のためのJSlinkを実装しました

(function () {

// Create object that have the context information about the field that we want to change it output render 
var viewContext = {};
viewContext.Templates = {};

viewContext.Templates.Fields = {
    "Field":{"View": renderPlainText}       
};

SPClientTemplates.TemplateManager.RegisterTemplateOverrides(viewContext);})(); 
.

私のレンダリング機能は以下のようになります。 -

function renderPlainText(ctx) {
var value = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
value = value.replace(/<(?:.|\n)*?>/gm, '');
return "<div>" + value + "</div>"; }
.

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top