The title is a little vague; wasn't sure how to word it.
Anyway, what I'm wanting to do is use a button, and when pressed, it would get the name of the current window (this part isn't a problem), and then it would look in the SQLite database for the row that has the 'entity_name' column value that is the same as the title of the window, and then it would go into that row and change the 'favorite' column value to 1.
So, that's what I'd like it to do, and the part that I actually can't figure out is just checking all the rows for the one with the correct name value, and then just making the one change in that row.
Something like:
Update [table name] Set favorite= '1' Where ColumName = 'entity_name'
Related
I would like to handle the dirty state for every single row I have in my table. Unfortunately, adding a form around a would break the table, and I can't create it inside since I have a field for every different column. My last column for each row contains buttons: Delete and Update. Update appears only if one of the field of this row has been made dirty.
Somehow, it works already but I am checking each .pristine for every field on that row (#name="ngModel"). My rows are created through something like *ngFor="let row of rows". I believe it would be better to check the .dirty or .pristine on a form rather than on every single element.
Also, if I actually to the update, there is no way I can remove that .dirty status (I tried replacing the data for that row by removing from the array and re-adding it but it is still dirty).
Is there a technique to go around that?
You could use ngModelGroup around each of your rows. Then you can check the dirty flag for the group.
I have a Tabular Form with a few columns, one of which is a numeric entry that has values 1 or 0, represented by a checkbox.
I'd like to create a "master-checkbox" that would check all the checkboxes in this column, but it wouldn't sumbit the page, the user would have to do it manually by "Apply Changes".
I figured out that I need to use apex.item and some javascript and unfortunately, that's as far as I got.
Actually, it wasn't as easy as the google results suggest.
Apex' checkbox appears to be just a cosmetic thing and the real thing is hidden.
My colleague helped me to do something like this:
$("td[headers=APPROVED] input[type=checkbox]").attr("checked", 1); // this is the "visual" part
$("td[headers=APPROVED] input[type=hidden]").val(1); // and this is he one that gets stuff done
"APPROVED" is the name of the column I am manipulating.
The following classic report which when we select specific row pops up with new modal region called addExtraDetails with some data grabbed from row and some new additional info required from user:
When (+) is being clicked the new modal region pops up, with populated values taken from the report row. So: in Column link I put:
javascript:function_to_add_to_basket('E',#ID#, 'Extra#ROWNUM#', #PRICE#,'DUMMY');
Then external js function is responsible for passing information. The problem is it does not refresh every time (+) is populated instead it keeps values of the first input.
I found better solution(and cleaner), upon clicking (+) Column Link is passing:
javascript:$s('P4_SET_QUANTITY','#QUANTITY#');
javascript:$s('P4_SET_TYPE','E');
javascript:$s('P4_SET_OBJECT_ID','#ID#');
javascript:$s('P4_SET_ELEMENT_ID','Extra#ROWNUM#');
javascript:$s('P4_SET_COST','#PRICE#');
javascript:$s('P4_SET_DISCOUNT','DUMMY');
javascript:openModal('addExtraDetails');
Now it updates everytime when we select various rows HOWEVER since we have dropdown javascript grabs all possible value of Quantity column so for this code:
javascript:$s('P4_SET_QUANTITY','#QUANTITY#');
the output is: '012345678910'.
How can I pass all values to modal region and make it to work with new values every time its being called ?
You need to retrieve the value of the select list when you click the modal button. The value is not static, unlike the other values. The substitution strings are replaced with their value when the page is rendered.
It isn't really necessary to do all those item sets if all you want to do is use them in a javascript function. Your first idea was probably just as good but I'll just run with openModal.
First, determine how to target the select list. You did not specify whether your report is a wizard-generated tabular form or a manual tabular form (ie used apex_item to make the select list). You could either target the select list by the name attribute, which refers to an array, or select by header of the column. Also see this article.
Eg, with the column name for the select list being QUANTITY, selecting the list would be:
td[headers=QUANTITY] select:visible
Alternatively, if you determine the array you can be more precise in targetting the element. Eg if the NAME attribute is set to f02 then you could select the select lists with
input[name=f02]
Then modify the openModal function to select the list value on the same row as pThis - which would be the triggering element, the anchor :
function openModal(pThis, pMethod){
//fetch the value of the select list on the same row
//I use the second method of selecting here
var lListValue = $(pThis).closest('tr').find('input[name=f02]').val();
...
}
You'll also need to adjust your call to openModal:
javascript:openModal(this, 'addExtraDetails');
I have a quick question. I am wanting to retrieve a value from my sqlite table (a specific value from a row in a specific column) and I was wondering how to get that value and put it back into a selectmenu.
$('#items option:selected').val(row['column1']);
This is what I have so far in my select statement for sqlite. The #items is the id of my selectmenu, and val.(row['column1']) is the value that I want to get to put it inside the selectmenu specified if that makes sense.
I should note that I have successfully done this for all the form data, the values are being retrieved and displayed correctly, it's just the selectmenu that isn't displaying the required value. Thanks
Got it working, changed to:
$('#items').val(row['column1']);
then added this after the for loop in the sqlite statement:
$('#items').selectmenu('refresh', true);
This correctly displayed the value from the table.
I'm trying to implement 2 things:
Adding edittype:'password' to one of my columns so I will be able to see *** instead of the actual value itself. The problem here is that I see *** only when I edit the row, but when I select another row, I save the old row, and disable it from editing mode, but now when it's not an input I can see the actual value - so it's like I never used password input. What do I need to do in order to see the value as password also when I'm not in edit mode??
I want to condition the password column not to be on all rows of this column, is that possible to do? I want to check another value from the row and only if it equals a certain value I want to set the field as password, and if it's not equals to leave it as a regular field. How can this be done?
1) When you select another row and change the old row to disable edit mode, replace all characters in the textbox with a '*' after saving the row. Since it's saved you don't need to maintain the value since it's not an input anymore.
2) use jquery selectors to selectively place the password attribute based on the value of the other row, also selected using a jquery selector. Since it seems like a grid you are working with all cells should have a unique identifier to use for selection.
The conditioning of the column would probably be easiest to set after rendering. Without having more information about the grid layout and specifics about the columns some of this is guess work.