Dojo中datagrid刷新实现

当针对datagrid数据做修改是需要对datagrid(dojox.grid.EnhancedGrid)做更新,Dojo中datagrid没有refresh类的方法

下面在增删改例子中简单实现数据更新:

增加操作:

function addObject(){
        var form = dojo.byId("myForm");

        var xhrArgs = {
            form: form,
            load: function(data){
                if(data=="100"){
                    store.newItem({id:form.id.value,channelName:form.channelName.value});
                }
            },
            error: function(error){
                console.log(error);
            }
        }
        var deferred = dojo.xhrPost(xhrArgs);
}

当新建数据提交服务器成功后,通过store.newItem方法将对象添加到datagrid的store中

 

修改对象:

function editObject(id){
        var form = dojo.byId("myForm");
        var xhrArgs = {
            form:form,
            load: function(data){
                console.log("edit ok:"+id)
                store.fetchItemByIdentity({
                    identity: id,
                    onItem: function(item){

                        if(item){

                           store.setValue(item,"channelName",form.channelName.value);

                        }
                    }
                });
          
            },
            error: function(error){

            }
        }
        var deferred = dojo.xhrPost(xhrArgs);

    }

当修改操作提交服务器成功后,通过store.setValue方法更新数据。

 

删除对象:

function deleteObject(id){
        if(confirm("确定要删除此记录?")) {
            var xhrArgs = {
                url:APP_CONTEXT_PATH+"/channel/delete/"+id,
                handleAs: "json",
                load: function(data){
                    store.fetchItemByIdentity({
                        identity: id,
                        onItem: function(item){
                            if(item){
                                try{store.deleteItem(item);}catch(err) {}

                            }
                        }
                    });
                },
                error: function(error){

                }
            }
            var deferred = dojo.xhrGet(xhrArgs);
        }
    }

服务器删除成功后调用store.deleteItem方法删除store中的数据。

本地刷新可以避免重复调用服务器,减少对服务器请求次数

135 thoughts on “Dojo中datagrid刷新实现”

  1. I am just writing to make you understand what a really good experience my cousin’s girl undergone browsing the blog. She realized so many details, with the inclusion of what it is like to possess a wonderful helping nature to let other folks without problems fully understand certain multifaceted subject matter. You undoubtedly did more than our own desires. I appreciate you for coming up with those warm and helpful, safe, revealing not to mention fun tips about your topic to Ethel.

  2. I definitely wanted to write down a small note so as to appreciate you for these amazing guides you are sharing on this website. My extensive internet research has finally been paid with reasonable details to talk about with my two friends. I ‘d tell you that we readers actually are very much lucky to live in a fabulous site with many wonderful people with valuable tactics. I feel very much happy to have come across your weblog and look forward to many more cool moments reading here. Thanks a lot once again for all the details.

  3. I want to express my respect for your kind-heartedness for individuals who actually need help with the study. Your real commitment to passing the solution around ended up being particularly useful and have surely enabled others like me to achieve their goals. Your new warm and helpful report denotes so much a person like me and somewhat more to my peers. Regards; from everyone of us.

  4. A lot of thanks for all of the labor on this blog. Kim take interest in conducting internet research and it is obvious why. My partner and i know all about the powerful method you offer very useful techniques through this blog and in addition boost response from some others on that article and our own girl is now learning so much. Enjoy the remaining portion of the year. You’re the one carrying out a dazzling job.

  5. I wanted to create you the very small word just to thank you once again for all the wonderful thoughts you’ve documented on this site. It is extremely open-handed of you to present freely all numerous people would have sold for an e-book to get some money on their own, primarily given that you could have tried it in the event you decided. Those good ideas additionally acted like the easy way to be aware that some people have a similar eagerness just as my personal own to realize way more in respect of this issue. I’m certain there are a lot more fun times ahead for many who read through your website.

  6. I simply wished to thank you very much once again. I am not sure what I would have created in the absence of these advice documented by you on that subject matter. It was actually an absolute fearsome issue in my position, nevertheless finding out a skilled fashion you processed that forced me to leap for gladness. I’m just happier for your work and expect you realize what a great job you’re getting into training others via your blog post. I’m certain you’ve never got to know any of us.

  7. I would like to show my love for your generosity supporting folks that require help on in this study. Your special commitment to getting the solution all-around had become astonishingly insightful and has usually permitted workers much like me to get to their endeavors. Your useful report implies a whole lot to me and a whole lot more to my fellow workers. Warm regards; from everyone of us.

  8. I wish to express appreciation to the writer for rescuing me from this type of predicament. Just after surfing around through the world wide web and meeting basics which are not powerful, I was thinking my entire life was gone. Living minus the solutions to the difficulties you’ve fixed through your main website is a serious case, and ones which may have in a negative way affected my entire career if I hadn’t encountered your web page. Your expertise and kindness in maneuvering all the details was useful. I’m not sure what I would’ve done if I had not encountered such a subject like this. I’m able to at this moment look ahead to my future. Thanks very much for your reliable and amazing guide. I will not hesitate to recommend the blog to any individual who desires counselling on this matter.

  9. I have to show my affection for your generosity in support of individuals that really want help on this one content. Your personal dedication to getting the solution around came to be quite functional and has consistently permitted many people just like me to get to their targets. Your personal important useful information signifies a great deal to me and substantially more to my office workers. Thanks a ton; from everyone of us.

  10. I really wanted to develop a quick word to thank you for these amazing advice you are sharing at this site. My extensive internet lookup has now been rewarded with useful suggestions to exchange with my great friends. I ‘d believe that most of us website visitors are undoubtedly blessed to be in a magnificent site with many awesome professionals with valuable tips and hints. I feel very much happy to have encountered your entire webpage and look forward to plenty of more brilliant moments reading here. Thanks a lot once more for everything.

  11. Thanks for each of your effort on this web site. My aunt enjoys conducting research and it is obvious why. All of us hear all regarding the compelling manner you offer vital techniques on the website and as well as boost response from some other people about this content so our princess is always understanding so much. Enjoy the rest of the new year. You’re the one carrying out a superb job.

  12. I am glad for commenting to make you know what a excellent experience my friend’s girl encountered studying your webblog. She came to understand too many pieces, with the inclusion of how it is like to have an excellent coaching mindset to make other individuals completely completely grasp chosen problematic subject areas. You really did more than our own desires. Thank you for producing these informative, healthy, informative and even easy tips about your topic to Lizeth.

  13. Thank you so much for giving everyone an extraordinarily remarkable chance to discover important secrets from this website. It really is very great and as well , stuffed with a great time for me personally and my office co-workers to search your blog really three times in a week to read through the latest guides you have got. And of course, I’m just usually fulfilled concerning the perfect solutions you serve. Selected 4 facts in this posting are unquestionably the most efficient we’ve had.

  14. I simply had to say thanks all over again. I do not know the things that I would have worked on without the actual suggestions shown by you relating to this topic. It absolutely was the intimidating condition for me, but taking note of this skilled manner you processed it took me to weep for joy. I am thankful for your help and then trust you really know what a powerful job your are putting in training others through your web blog. I am certain you’ve never got to know all of us.

  15. I wish to show my appreciation to you just for bailing me out of such a situation. After checking through the online world and seeing tips which are not helpful, I believed my entire life was over. Living without the presence of solutions to the issues you’ve resolved as a result of your entire posting is a critical case, as well as the kind which may have negatively damaged my entire career if I hadn’t come across your web site. Your personal knowledge and kindness in handling a lot of stuff was very helpful. I am not sure what I would have done if I had not come upon such a stuff like this. I can at this time look forward to my future. Thank you very much for this professional and results-oriented guide. I will not hesitate to recommend your blog to any person who needs to have guide on this situation.

  16. I want to express my passion for your kindness supporting all those that need assistance with this particular issue. Your personal dedication to passing the message all around appeared to be wonderfully useful and has all the time permitted those like me to get to their ambitions. Your entire insightful guideline signifies much to me and further more to my office colleagues. Thanks a ton; from everyone of us.

  17. [url=https://retina911.com/]retin a[/url] [url=https://tadalafil0.com/]tadalafil 20mg coupon[/url] [url=https://buspar24.com/]buspar[/url] [url=https://levitra19.com/]buy levitra online uk[/url] [url=https://sildenafil3.com/]buy sildenafil online[/url]

  18. [url=https://lisinopril911.com/]lisinopril[/url] [url=https://colchicine05.com/]colchicine 0.5[/url] [url=https://diflucan24.com/]diflucan[/url]

  19. I want to express my passion for your generosity supporting visitors who require help with your area of interest. Your personal dedication to passing the message throughout turned out to be astonishingly good and has consistently made guys like me to arrive at their ambitions. Your personal helpful guidelines means so much to me and especially to my peers. Thank you; from everyone of us.

  20. I and my pals ended up checking out the great strategies from your site then immediately came up with an awful suspicion I never expressed respect to the web site owner for those tips. My women appeared to be as a consequence excited to see all of them and already have in reality been having fun with these things. Thanks for getting so accommodating and also for going for this form of tremendous subjects most people are really needing to discover. Our honest apologies for not saying thanks to sooner.

  21. I actually wanted to develop a simple message so as to express gratitude to you for all the splendid tricks you are writing at this website. My long internet research has at the end of the day been recognized with reputable content to exchange with my co-workers. I ‘d declare that most of us visitors are undeniably fortunate to exist in a notable website with very many brilliant people with valuable strategies. I feel truly lucky to have encountered your entire webpage and look forward to tons of more thrilling times reading here. Thank you again for all the details.

  22. I want to convey my passion for your kind-heartedness in support of men and women that must have help with this important idea. Your special dedication to passing the message up and down was especially good and has surely encouraged guys just like me to realize their goals. This helpful guidelines means a great deal a person like me and much more to my office colleagues. Best wishes; from all of us.

  23. Thanks so much for providing individuals with a very nice possiblity to read critical reviews from this site. It’s always very terrific and as well , full of a good time for me personally and my office colleagues to visit your web site really 3 times in 7 days to read the newest items you have got. And definitely, I am also at all times contented concerning the tremendous principles you serve. Some 4 areas in this posting are surely the most efficient we have had.

  24. I wish to convey my love for your generosity in support of persons that really need help with this important area. Your personal commitment to passing the solution all around has been pretty important and has all the time empowered most people much like me to attain their objectives. This insightful facts can mean a whole lot to me and additionally to my fellow workers. Best wishes; from each one of us.

  25. I want to express my respect for your generosity in support of those people that absolutely need help on this important theme. Your very own commitment to getting the message all through had been amazingly interesting and have specifically allowed others much like me to achieve their goals. This informative tips and hints means a whole lot to me and extremely more to my office workers. With thanks; from everyone of us.

  26. Thanks a lot for providing individuals with an exceptionally marvellous opportunity to read in detail from this web site. It really is so kind and jam-packed with a lot of fun for me and my office acquaintances to search your site a minimum of thrice a week to see the newest guidance you have. And lastly, I’m just usually happy concerning the perfect pointers served by you. Selected two points in this posting are basically the most effective we’ve had.

  27. I have to show my passion for your kindness in support of folks who absolutely need assistance with this important idea. Your special commitment to getting the message up and down became surprisingly helpful and have in every case enabled women much like me to realize their dreams. Your informative advice entails so much to me and somewhat more to my fellow workers. Many thanks; from all of us.

  28. I definitely wanted to make a simple remark to be able to appreciate you for all the fabulous guidelines you are showing on this site. My rather long internet research has at the end been compensated with extremely good suggestions to exchange with my visitors. I would point out that many of us site visitors actually are quite fortunate to live in a superb place with many perfect individuals with good opinions. I feel pretty grateful to have discovered the web pages and look forward to plenty of more fun moments reading here. Thank you once again for all the details.

  29. My husband and i felt joyous Chris could do his investigations by way of the precious recommendations he made through the site. It’s not at all simplistic to simply possibly be giving freely helpful tips that many some others might have been trying to sell. And now we see we have got the blog owner to give thanks to because of that. The entire illustrations you’ve made, the straightforward site navigation, the relationships you can aid to create – it is mostly overwhelming, and it’s making our son in addition to us believe that the content is entertaining, and that is highly important. Thank you for all the pieces!

  30. My husband and i felt now fulfilled Chris could carry out his inquiry through the ideas he was given from your web page. It’s not at all simplistic just to happen to be giving away tips and tricks which usually some others could have been trying to sell. We consider we have the blog owner to give thanks to for this. The type of explanations you made, the simple website navigation, the relationships your site give support to foster – it is most remarkable, and it’s helping our son and our family feel that that subject is exciting, and that is tremendously vital. Many thanks for the whole lot!

发表评论

电子邮件地址不会被公开。 必填项已用*标注