I have a grid which contains elements populated from a list. How do I update a local storage array with the elements from the grid? I tried the following mapping, but it only map one element to the storage array, instead of all elements on the grid.
Hi,
Please see how to map grid here https://devcenter.appery.io/documenta...
Hello Dandy,
You are right it is not allowed create mapping from grid to array (because grid is not array). Could you tell why do you need such mapping? Do you need write one more array item to the storage variable? Please follow this topic: https://getsatisfaction.com/apperyio/...
I have managed to do this using jQuery .each() function as I noticed each grid is essentially a duplicate of the parent grid and has similar naming.
Code: Select all
$("[id^='patientProfile_mobilegrid_74_']").each(function(){
var diag={
diagnosis : $(this).find("[name='mobiletextinput_70']").val(),
consultant : $(this).find("[name='mobiletextinput_72']").val(),
dateOfReferral : $(this).find("[name='mobiledatepicker_55']").find('input').val()
};
storagePush("beforeSendPatientDiagnosis", diag);
}); To Sergiy:
The reason I need this is that I have an array of items from the database that is listed out as text edit using the grid. This list is editable, and once it is edited, I want to save it back to the database. Hence, I need to map it from the grid to the array in the database.
Currently, how I do this is by pushing the content of the list to the storage variable using jQuery's .each() as shown above, then I map the storage variable to the database.
Please write item id as grid HTML-attribute and read it when you need change value in DB. One item per one request. Here you can find an example: https://devcenter.appery.io/documenta...