Oracle Apex Dynamic actions in tabular form - dynamic

I am developing an app that captures the every day resource utilization of a person in a team.
I completed every thing and stuck up at a point i.e
Please find the below link for the image (I cant upload image here as I am a new user)
http://s17.postimg.org/qgh6559rj/image.jpg
As shown in the above image I created a Tabular form for this where month is a drop down list and year is a text box, the days 1,2,3,....31 are text boxes to capture utilized time.
My requirement is to make the days greyed out and lock (not to allow the user to enter data) for the days which are not in that month.
ex: when Month : Feb then 29,30,31 : greyed out and locked
I have searched in many websites for the solution, But I couldn't get one.

Hi Aditya,
I tried to solve this problem.I created similar tabular form having colmns like day1,day2...Day29,Day30,Day31.Here I have focused on only day29,Day30,Day31 as because only these columns will get affect on change of year. Rather than dynamic action I have called JavaScript function hideShow() on change of year
Following is code for hideShow where as f04,f05,f06 are day29,day30,day31.
In this function I also added possibility of leap year
function hideShow(pThis)
{
var month=$(pThis).closest('tr').find('[name="f02"]').val();
var year=$(pThis).val();
if (Boolean(parseInt(year) % 4 == 0)&&Boolean(parseInt(year) % 100 != 0)||Boolean(parseInt(year) % 400 == 0)) {
if (month.trim()=='FEB') {
$(pThis).closest('tr').find('[name="f05"]').attr("disabled","disabled");
$(pThis).closest('tr').find('[name="f06"]').attr("disabled","disabled");
}
}
else {
if (month.trim()=='FEB') {
$(pThis).closest('tr').find('[name="f04"]').attr("disabled","disabled");
$(pThis).closest('tr').find('[name="f05"]').attr("disabled","disabled");
$(pThis).closest('tr').find('[name="f06"]').attr("disabled","disabled");
}
}
if(month.trim()=='APR') {
$(pThis).closest('tr').find('[name="f06"]').attr("disabled","disabled");
}
else if(month.trim()=='JUN') {
$(pThis).closest('tr').find('[name="f06"]').attr("disabled","disabled");
}
else if(month.trim()=='SEP') {
$(pThis).closest('tr').find('[name="f06"]').attr("disabled","disabled");
}
else if(month.trim()=='JAN'||month.trim()=='MAR'||month.trim()=='MAY'||month.trim()=='JUL'||month.trim()=='AUG') {
$(pThis).closest('tr').find('[name="f04"]').attr("disabled",false);
$(pThis).closest('tr').find('[name="f05"]').attr("disabled",false);
$(pThis).closest('tr').find('[name="f06"]').attr("disabled",false);
}
}
Here I only worked with disable/enable, similarly it is also possible to apply css runtime, Hope this code will help you...

Related

Is there a way to set the timezone in Vue with the UTC code?

I'm implementing a system and I need to set the timezone for the device depending on the item selected from a list that I'm showing to the user.
This is the design the customer wants:
I managed to implement this design. The problem is how can I set the timezone in the system, using only the code from the list? (for example: "UTC-12:00")
I've been reading around and the solution proposed is to use Javascript moment library, but it doesn't allow me to change the timezone like this.
The code I tried for the Save button is this:
saveTimeZone() {
if ( this.newTimeZone ) {
moment( new Date() ).tz.setDefault( this.newTimeZone );
}
}
And the value newTimeZone is setted up when clicked the list item:
selectTimeZone( item ) {
if ( this.getTime !== item ) {
this.newTimeZone = item;
this.disableSafeBtn = false;
}
}
Does anyone have any workaround for this?

How to change the current time in the progress control?

Is it possible to manualy set the current time position on the timeline? I need this because I have several separated videos which represent one video and are playing in different players.
For example, the actual current time is marked as white dot, the desired current time that I want to show as red dot.
Can I do this somehow without creating completely new custom controlbar?
Middleware could be part of the solution, which allows you to intercept and modify what's sent to / received from the playback tech (video element).
var myMiddleware = function(player) {
return {
currentTime: function(ct) {
// When the video el says the currentTime is 60s, report 160s
return ct + 100;
},
setCurrentTime: function(time) {
// When the user / progress bar wants to seek to 220s, actually seek to 120s
return time - 100;
}
};
};
videojs.use('*', myMiddleware);

How can I Group Rows via the Google Sheets API?

I'm looking for a way to create a group of rows via the Google Sheets API - is there a way to do this? I can't see to find an API that will do this, but it seems like it should be a fairly common formatting need.
This feature is supported in the UI by selecting a set of rows, right clicking and the option pops up to create a group, see the screenshot linked below. I'm just looking for a way to do that via an API.
Use this --> Range.shiftColumnGroupDepth
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
var range = sheet.getActiveRange();
// The column grouping depth is increased by 1.
range.shiftColumnGroupDepth(1);
// The column grouping depth is decreased by 1.
range.shiftColumnGroupDepth(-1);
You can accomplish this through version 4 of the Google Sheets API.
You will need to submit an HTTP POST to this endpoint:
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}:batchUpdate
You will need to pass a valid JSON request. I created a simple spreadsheet with some rows to group and used this JSON as a test to group rows 14-17:
{
"requests": [
{
"addDimensionGroup": {
"range": {
"dimension": "ROWS",
"sheetId": 0,
"startIndex": 14,
"endIndex": 17
}
}
}
]
}
Note that the startIndex is the row (or column) number that everything will fold into and will remain visible even if you collapse the group, while endIndex is the last element of the group which will remain hidden when the group is collapsed.
The documentation for this is here. If your window is wide enough it will show a "Try this API" pane on the right side. You can enter the spreadsheetId of your sheet and build up the JSON request body and test it to see it work directly on a sheet - if you have it open in another window you should see the update happen almost immediate after you click the "Execute" button.
Creating Column and Row Groups
Column Groups
function createSomeColumGroups() {
var ss=SpreadsheetApp.getActive();
var sh=ss.getSheetByName("Sheet189");//this is used in the request
var resource='{"requests": [';
for(var i=1;i<25;i+=3) {//start at column 1 and ends at 24 making them in groups of 3
if(i>1){resource+=', ';}
resource+=Utilities.formatString('{"addDimensionGroup": {"range": {"dimension": "COLUMNS","sheetId": %s,"startIndex": %s ,"endIndex": %s}}}',sh.getSheetId(),i,i+2);
}
resource+=']}';
Logger.log(resource);
Sheets.Spreadsheets.batchUpdate(resource, ss.getId());
}
Row Groups
function createSomeRowGroups() {
var ss=SpreadsheetApp.getActive();
var sh=ss.getSheetByName("Sheet189");
var resource='{"requests": [';
for(var i=1;i<25;i+=3) {
if(i>1){resource+=', ';}
resource+=Utilities.formatString('{"addDimensionGroup": {"range": {"dimension": "ROWS","sheetId": %s,"startIndex": %s ,"endIndex": %s}}}',sh.getSheetId(),i,i+2);
}
resource+=']}';
Logger.log(resource);
Sheets.Spreadsheets.batchUpdate(resource, ss.getId());
}
Don't forget to go the Advanced Google Services and enable Sheets API version 4 and you will also have to enable on the Google Cloud Platform

lucene query filter not working

I am using this filter hook in my Auth0 Delegated Administration Extension.
function(ctx, callback) {
// Get the company from the current user's metadata.
var company = ctx.request.user.app_metadata && ctx.request.user.app_metadata.company;
if (!company || !company.length) {
return callback(new Error('The current user is not part of any company.'));
}
// The GREEN company can see all users.
if (company === 'GREEN') {
return callback();
}
// Return the lucene query.
return callback(null, 'app_metadata.company:"' + company + '"');
}
When user logged in whose company is GREEN can see all users. But when user logged in whose company is RED can't see any users whose company is RED.
I need to make this when user logged in, user should only be able to access users within his company. (except users from GREEN company).
But above code is not giving expected result. What could be the issue?
This might be related to a little warning note on the User Search documentation page
Basically they don't let you search for properties in the app_metadata field anymore. Unfortunately, this change was breaking and unannounced.
We had to make changes to our API so that we keep a copy of the app_metadatas in a separate database and convert lucene syntax to MongoDB queries, so that we can query by a chain of user_id:"<>" OR user_id:"<>" OR ....
One caveat though, you can't pass a query that's longer than 72 user_ids long. This number is so far undocumented and obtained empirically.
Also, you can't rely on Auth0's hooks to add new users to your database, as these don't fire for social logins, only for Username-Password-Authentication connections.
I hope this gave you some explanation as for why it wasn't working as well as a possible solution.
If I were you, I would look for an alternative for Auth0, which is what we are currently doing.
I finally ended up with this solution.
Used search functionality to filter users. I had to change below two files.
fetchUsers function in client\actions\user.js
changed
export function fetchUsers(search = '', reset = false, page = 0)
to
export function fetchUsers(search = '#red.com', reset = false,
page = 0)
AND
onReset function in client\containers\Users\Users.jsx
changed
onReset = () => { this.props.fetchUsers('', true); }
to
onReset = () => { this.props.fetchUsers('#red.com', true); }

Rally Kanban for Logged In Owner

I'm new to Rally's SDK. I'm trying to create a Kanban board that only shows the cards where the owner field = the person who's logged in (i.e. a My Kanban Board). What code should I add and where should I add it?
The following isn't my ideal answer to this issue, but I'd thought I'd post in case it helps someone else. I took the code from the Filter Epic post as suggested and modified it. It's not ideal for me because the filter occurs after the initial data pull, so it is only filtering the first 100 records the initial query pulled. Ideally, I want to change the initial pull of data to filter on username.
After this code in the Filtering Epic:
for (i=0;i<workproducts.length;i++) {
thisWorkProduct = workproducts[i];
Add:
//get the owner field value
var owner = "";
if (thisWorkProduct.Owner) {
if (thisWorkProduct.Owner.DisplayName) {
owner = thisWorkProduct.Owner.DisplayName;
}
else if (thisWorkProduct.Owner.UserName) {
owner = thisWorkProduct.Owner.UserName;
}
}
And then change:
if (thisWorkProduct.Children.length === 0) {
To:
if ((thisWorkProduct.Children.length === 0) && (owner === "__USER_NAME__")) {
And add in an if in the defects else (so it will now look like this):
else {
// If it's a Defect, it has no children so push it
if (owner === "__USER_NAME__") {
childlessWorkProducts.push(thisWorkProduct);
}
It's probably not the most efficient code because I'm new to javascript.
And if anyone has suggestions on how to do the username filter in the initial data pull, I'd love to hear them.
You can filter on the initial data pull by including a query in the cardboardConfig object:
var cardboardConfig = {
//... other properties
query: new rally.sdk.util.Query('Owner = /user/__USER_OID__')
};
Check out this answer:
Filtering epics from Kanban board
It would be pretty straightforward to adapt the filtering callback to filter by Owner instead of just child-less artifacts.