Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6766119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:47:33+00:00 2026-05-26T14:47:33+00:00

Most of the render function in the following view is irrelevant, I think but

  • 0

Most of the render function in the following view is irrelevant, I think but I’m leaving it for completeness. I’m stepping through a list of workflow steps, noting switching the class of the li depending on various states of the thing.

var WorkStepView = Backbone.View.extend({
    className: "workflowStep",

    render: function() {
        var output;
        var arrowPlaced = false;
        var self = this;
        i = 0;
        _.each(this.collection.models, function(s) {
            var post = "";
            var classname = '';
            if (s.attributes["complete"] != 1) {
                if (! arrowPlaced) {
                    classname = "current";
                    if (s.attributes["adminCompletable"] == 1 ) {
                        post = ' - <input onClick="completeStep(' + i + ');" type="button" value="Completed" />';
                    }
                    arrowPlaced = true;
                }
                else {
                    classname = "future";
                }
            }
            else {
                classname = "past";
            }
            output += '<li class="' + classname + '">' +  s.attributes["description"] + post + '</li>';
            i++;
        });
        this.el.innerHTML = output;
        return this;
    },
});

When the user selects an asset from a list elsewhere on the page, it brings up a bunch of data including this stuff. An asset “has” a workflow, which “has” many steps. The step data is stored in window.Steps, and then this is called:

function populateSteps() {
    window.workStepLists = new WorkStepView({
        collection: window.Steps,
        el: $('#workflowSteps')[0],
    });
    workStepLists.render();
}

But then I get this:
enter image description here

There’s this extraneous “undefined” up there at the top of the list. It wasn’t there before fetching and rendering this model. I don’t know what’s up with that at all.

Help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:47:33+00:00Added an answer on May 26, 2026 at 2:47 pm

    You are not initializing output to be anything. So, output += "foo" becomes “undefinedfoo”.

    Simply initialize your output variable with an empty string:

    var output = '';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code snippet: template = \ function routes(app, model){\ app.get('/preNew{className}', function(req, res){\ res.render('{className}'.ejs,
Take for example the following controller/action: public function indexAction() { return $this->render('TestBundle:TestController:index.html.twig'); } I
In most BackboneJS examples I've seen, parent views call the render() function on child
Do CSS colors render differently on different monitors? Most importantly, will tools like Digital
Most of us write conditionals like: if (resultIndex == 0) ...but occaisionally I come
I am using shared editor templates to render nested collections in my view with
Suppose you have a Django view that has two functions: The first function renders
I'm working through some tutorial code and like most tutorial code, the json object
Ok so i've made this function which works fine for converting most urls like
The error that I am receiving is the following: Traceback (most recent call last):

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.