[jQuery] Data() method, just changing value of one hash element
I am using the jQuery Data method to store data for dynamically
created elements. Everything works fine until I try to update the
value of an attribute.
This is how I first create the element.
$j.data(item, 'attributes', {
Name: name,
UOM: uom,
WarehouseKey: orderItem.WarehouseKey,
OriginalPrice: orderItem.OriginalPrice,
ReqDate: dsOrder.cleanupResults(orderItem.ReqDate),
WarehouseItemKey: orderItem.WarehouseItemKey,
AvailableQty: orderItem.AvailableQty,
BOQty: orderItem.BOQty,
Notes: dsOrder.cleanupResults(orderItem.Notes),
Cost: orderItem.Cost,
GP: dsOrder.cleanupResults(orderItem.GP),
Description: dsOrder.cleanupResults
(orderItem.description)
});
At a later point based on a user's interaction, the required date,
note, and warehouse key gets updated.
This is the first way I tried updating it, it doesn't store the value.
$j(item, 'attributes.ReqDate', $j('#section_item #requiredDate').attr
('value'));
Then I tried it like this
$j.data(item, 'attributes', {
'WarehouseKey': $j('#<%=ItemWarehouseList.ClientId
%>').val()
});
This overwrited all the other data stored in 'attributes'. Only
WarehouseKey is then saved.
Is there a way to change just one value without affecting the rest of
the data?