Új hozzászólás Aktív témák

  • Lokids

    addikt

    Sziasztok!

    Az alábbi kódban kérnék segítséget. Lefut, de minden zöld, dátumtól függetlenül:
    function colorCodeRows() {

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
    OnPostRender: function (ctx) {

    // get today's date
    var today = new Date();
    // zero out the time portion so we will only compare days
    today.setHours(0,0,0,0);

    var rows = ctx.ListData.Row;
    for (var i = 0; i < rows.length; i++) {

    // get the date set in your date YourDateField
    var itemDate = new Date(rows[i]["Határidő"]);
    // zero out the time portion so we only compare days
    itemDate.setHours(0,0,0,0);

    var rowId = GenerateIIDForListItem(ctx, rows[i]);
    var row = document.getElementById(rowId);

    if (itemDate > today) {
    row.style.backgroundColor = '#00FF00';
    } else if (itemDate = today) {
    row.style.backgroundColor = '#FFFF00';
    } else if (itemDate < today) {
    row.style.backgroundColor = '#FF0000';
    }
    }
    }
    });
    }
    RegisterModuleInit(SPClientTemplates.Utility.ReplaceUrlTokens('~site/SiteAssets/JSLink/coloring.js'), colorCodeRows);
    colorCodeRows();

    Nem tudom mit nézek be, mert elvileg teljesül a többi feltétel, de a notepad nem tud lépésenkénti futtatást.

Új hozzászólás Aktív témák

Hirdetés