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

  • Home
  • SEARCH
  • 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 8105069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:04:21+00:00 2026-06-06T00:04:21+00:00

I have a JavaScript code segment for loading server’s data items, and insert them

  • 0

I have a JavaScript code segment for loading server’s data items, and insert them into UL element with generated LI elements like this:

function loadNewFileTemplates() {

    var list = _fileTemplateContainer.find("ul");

    $.submitToServer("[server URL]", null, function (data) {

        list.empty();

        if (data == "") {
            list.append("Templates not available."); // in sample code, removed HTML tags
        }
        else {
            $.each(data, function (index, item) {

                var itemElement = $("[HTML template string]");

                itemElement.find("div[data-field='image']").css("background-image", "url(" + item.icon + ")");
                itemElement.find("div[data-field='caption']").text(item.caption);
                itemElement.find("div[data-field='description']").text(item.description);
                itemElement.find("div[data-field='type']").text(item.type);

                itemElement.bind("click", function (e) {

                    $(e.target).parents("ul").find("li").removeClass("projectSelected");
                    $(e.target).parents("li").addClass("projectSelected");

                });

                itemElement.appendTo(list);

            });
        }

        console.log(list);
    });

}

This code works on first loading, but in second loading, the UI cannot refresh after elements inserted into UL element.

I confirmed the data is inserted successfully (use console.log() to output result), so I can’t find the reason about this issue.

Please view the screen shot for this issue.

How to resolve this problem?
Thanks.

My browser: Chrome 19.0.1084.56, IE 9.0.8112.16421
jQuery version 1.5.1

  • 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-06-06T00:04:22+00:00Added an answer on June 6, 2026 at 12:04 am

    I resolved this issue myself.

    I use my jQuery plug-in to initialize this form by using the following code:

    
        designFrameManager.updateFrameBody(data); // data is a HTML string.
    
        projectDesigner = $(data).projectDesigner({
            height: designFrameManager.getBodyHeight(),
            width: designFrameManager.getBodyWidth(),
            projectName: name
        });
    
    

    updateFrameBody() method’s code:

        this.updateFrameBody = function (ui, initFunction) {
    
            _designFrameBody.html(ui);
    
            if (initFunction != null && $.isFunction(initFunction))
                initFunction();
    
        };
    

    I think the plug-in’s initialization can’t be binded to DOM because the init action is after UI binding to DOM, so DOM can’t auto-refresh the changes after my script’s call.

    So, I update the code to this:

    
        projectDesigner = $(data).projectDesigner({
            height: designFrameManager.getBodyHeight(),
            width: designFrameManager.getBodyWidth(),
            projectName: name
        });
    
        designFrameManager.updateFrameBodyByObject(
           projectDesigner // initialized object
        ); 
    
    

    updateFrameBodyByObject() method’s code:

       this.updateFrameBodyByObject = function (ui, initFunction) {
    
            _designFrameBody.html("");
            _designFrameBody.append(ui);
    
            if (initFunction != null && $.isFunction(initFunction))
                initFunction();
    
        };
    

    This issue is fixed successfully.

    Thanks for all replies.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this JavaScript code: for (var idx in data) { var row =
I have javascript/jquery code which fetches info and updates it into the database with
I have some javascript code that will pass data to a pop up for
I have a javascript code, containing an array with trailing comma items:[{ id: 'col-1',
I have JavaScript code that retrieves numerical vectors from a web-service. The original data
I have javascript code as: var plot1 = jQuery.jqplot ('chartdiv', [data], { seriesDefaults: {
I have javascript code embedded inside a html template file. When I load this
I have JavaScript code which copies the value of input file and paste it
i have this javascript code to which i want to add the jquery fade-in
I have some Javascript code that will programmatically register an COM interop assembly by

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.