How can I run some code on all the nodes in a tree?

I want to run some code on all my treeView nodes depending on a value returned from the database and repeat this until a certain value is returned. I was thinking that: 1. Give all my tree nodes the same css class so I can access them from JQuery 2. have a timer in my JQuery function that used ajax to go to the database, when a certain value is returned then stop the timer Two questions here. How can I make my function run for each of the nodes and how do I do a timer in JavaScript, so:
$(function(){
    $('cssClassOfAllMyNodes').WhatFunctionToCallHere?((){
     
    //How do I do Timer functionality in JavaScript?
    ForEachTimeInterval
    {
       //use Ajax to go to database and retrieve a value
       AjaxCallBackFunction(result)
       {
         if (result = 1)
         //How to stop the timer here?
       }
    }
    });
});

Hope i'm clear. Thanks a lot

---

thanks a lot for the answer. And i would like you to comment on the design. 

Bascially what i'm trying to acheive is a Windows Wokflow type functionality where each node in my tree updates its image depending on its status, where its status is got from querying the database with a key unique to the tree node. I'm open to ideas on other ways to implement this if you have any. thanks again

以上就是How can I run some code on all the nodes in a tree?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏