jqgrid password field not only in edit mode - javascript

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.

Related

Removing last ng-form from validation in angularjs

I have a master detail form in angularjs. The form is typical transactions form with some master data like Name, type etc. The detail part contains many lines (can be added and deleted). Each line has input fields for Credit, Debit and Account Number. I have been able to add the required validations both on master portion of the form and detailed portion as well using ng-form directive. My form looks like following
you can see that I already have Add Row button that will add row on detail portion. Now I have strange requirement that is to add a row automatically when user is entering data in last row. I have even done that using ng-focus directive but the next part of requirement is to remove the last row from validation context if it is not used (not dirty) and successfully submit the remaining form. How can I do it in angular. Please find the Code on Plunkr and guide me how I can remove last row of detailed portion from validation context if it is not dirty.
ngRepeat sets $last to true for the last row. So you can just disable ng-require if an input is on the last row.
You could do something like data-ng-required="!entry.DebitAmoun && !$last" and similar for each input.
The above will work if you assume that last row always contains empty input fields. Whenever the user adds any value on the last row, then a new row is created.

How to check all checkboxes representing a DB column in Oracle ApEx with one click?

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.

Edit Values In A Row By Name Of Row

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'

Find exact value with jquery or javascript?

I have a table that has a hidden column that contains ids. I use the value in this column and send it to the server so I can grab the correct record.
I am not using datatables.net and I allow the user to update the row. So they click on an edit button and a dialog pops up and they edit it. Once they hit update I send all the values back including the id(stored in a hidden text field).
So I need to update the datatable and the fast way I found is use a plugin for it that allows you to take an html row and pass it to the datatable(instead of passing each column value in an array).
So first I need to delete the row then add the newly update row.
I have one problem though I don't know how to figure out which row to delete.
I could have some global variable that would store the row object and when it is time to delete it use that object. However I really don't want to do this as I don't want a global variable just flying around if I can help it.
So the hidden column with the value has a class name that I use as a slector(class ="hidden").
So I am wondering how could I do a search to filter down to only table cells that have this class name, has the exact value(say 55 that I can use from the hidden textbox).
I was thinking of using jquery contains but that might get stuff that might have that number. I want an exact match.
I'd suggest:
$('td.hidden:contains("55")')
This will find any td of class 'hidden' that contains the string '55', this is slightly problematic since it will also match the string '555', '055' etc.
Edited to refine the above a little, to make it specific to the required value:
$('td.hidden:contains("55")').filter(
function(){
return $(this).text() == '55';
}).closest('tr').addClass('highlight');
JS Fiddle demo.
Revised JS Fiddle demo, allowing searching.
While filter() would work perfectly well without the :contains() pseudo-selector I retained the :contains() in order to reduce the number of elements that jQuery has to work through.
References:
:contains().
filter().
Well, something like
$('body').find('.hidden').filter(function(elem) { ... } ).remove();
with whatever appropriate test in ....

Retaining changes made using Javascript to the page

I have a page which is having 2 tabs.
On first tab i have a table which contains some 'n' rows.
Each row is having a text box and depending on value entered in that text box, values in other cells for that row are calculated using JavaScript.
Now the problem is whenever i am moving to second tab after updating the text boxes and again coming back to first tab, then the values which are calculated using JavaScript are not retained whereas values entered in text box are retained.
How to retain those calculated values?
I would either re-trigger the javascript that does these calculations in an onblur event handler, or store the calculated values in cookies/session.
You could store this data in a cookie - this type of thing is exactly what they're for.

Categories