如何在索引数据库中更新对象存储中的项目 [英] How to update a item in a object store in Index db

查看:90
本文介绍了如何在索引数据库中更新对象存储中的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过ID获取商品.但是如何更新项目?


使用以下代码,我将获得价值

I am able get Item by id. But how to update the item ?


using the following code i am getting value

var transaction = db.transaction("Emp", IDBTransaction.READ_WRITE);
                var objectStore = transaction.objectStore("Emp");

                var request = objectStore.get(id);                
                request.onsuccess = function(evt) {  
                //alert(request.result.Name);
                if(request.result)
                {                
                $('#txt_1').val(request.result.Name);
                $('#txt_2').val(request.result.Cname);
                 $('#txt_3').val(request.result.Salary);
                 $('#txt_4').val(request.result.Address);
}
}



如果我想更改该特定记录的薪水.



if i want to change Salary of that particular record. how to do it

推荐答案

(' #txt_1' ).val(request.result.Name);
('#txt_1').val(request.result.Name);


('
('#txt_2').val(request.result.Cname);


(#txt_3').val(request.result.Salary);
('#txt_3').val(request.result.Salary);


这篇关于如何在索引数据库中更新对象存储中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆