Hi, so I am working on an app that can go online and offline using persist to local data. Long story short in order for me to be able to use a search button without doing any ajax callbacks to my server, I need two list controls. One for my sequel server to feed into, and one static list control that is being populated by the first one.
Before you start saying "Well you can just use the 'search client side' action scripting!", you should know that I am using the search function in a button to filter my list control into 3 groups by searching in a specific field for a specific value, and the client-side search function is underwhelmingly unhelpful by simply doing a keyword search across the entire table, without giving me the option to search in a specific field.
So I could really use some help with any ideas on how to essentially replicate a sql server based list control to a static one! I have tried making my own function using .appendrows(JSON); but I can't seem to stuff my arrays correctly into the json, so I tried it with a javascript object and that didn't seem to work either. I am fairly new to javascript so if you have any suggestions there that would also help! Thanks guys!
Before you start saying "Well you can just use the 'search client side' action scripting!", you should know that I am using the search function in a button to filter my list control into 3 groups by searching in a specific field for a specific value, and the client-side search function is underwhelmingly unhelpful by simply doing a keyword search across the entire table, without giving me the option to search in a specific field.
So I could really use some help with any ideas on how to essentially replicate a sql server based list control to a static one! I have tried making my own function using .appendrows(JSON); but I can't seem to stuff my arrays correctly into the json, so I tried it with a javascript object and that didn't seem to work either. I am fairly new to javascript so if you have any suggestions there that would also help! Thanks guys!
Code:
function populate_entireroutelist() { var reading_pntr = {dialog.object}.getControl('READINGS'); var entireroute_pntr = {dialog.object}.getControl('ENTIREROUTE'); var route_length = reading_pntr._data.length; //gets the length of the route var counter = 1; reading_pntr.setValue(0);//sets focus to the beginning var serviceAddress_holder;//we define our variables var customerName_holder; var read_unread_holder; var currentReading_holder; var _d = {}; //here we defined our object var serviceAddress = []; var customerName = []; var read_unread = []; var currentReading = []; for(i = 0; route_length > i; i++){ //this for loop creates the four arrays that I want to load into my object and display as variables into my static list serviceAddress_holder = {dialog.object}.getValue('serviceAddress');//this loads in the data into the variables customerName_holder = {dialog.object}.getValue('customerName'); read_unread_holder = {dialog.object}.getValue('FILLER1'); currentReading_holder = {dialog.object}.getValue('currentReading'); serviceAddress[serviceAddress.length] = serviceAddress_holder;//this assigns it into the next index into the array customerName[customerName.length] = customerName_holder; read_unread[read_unread.length] = read_unread_holder; currentReading[currentReading.length] = currentReading_holder; reading_pntr.setValue(counter); //this takes us to the next record counter++; } _d.serviceAddress = []; _d.customerName = []; _d.read_unread = []; _d.currentReading = []; for(i = 0; route_length > i; i++){// this is where I stuff those arrays into my object _d.serviceAddress[i] = serviceAddress[i]; _d.customerName[i] = customerName[i]; _d.read_unread[i] = read_unread[i]; _d.currentReading[i] = currentReading[i]; } entireroute_pntr.appendRows(_d);//this is where I finally try to append the rows onto my list control entireroute_pntr.setValue(0);//set focus to first row }
Comment