Prevent creating a new subgroup in syncfusion gantt chart without canceling the drop - syncfusion

We have the row grouping in our gantt only at one level deep such as in this stackblitz i've made where we also have activated the row drag'n drop feature.
(The one level grouping deep means that we don't want allow any subtasks being nested on each other in our own datasource passed to the gantt)
Now the problem we got is that when dropping a task on the dropPosition that is equal to "middleSegment" (on the rowDrop's hook args) then a new subgroup is created as you can see in this screenshot.
So far , the only way to prevent that behaviour is by using this trick from the Validating drop position documentation which consist on canceling the drag after the drop occurs.
It could be much better if there is any gantt grouping deep parameter which defined it so that drop on the "middleSegment" would be considered as a drop on the "topSegment" dropPosition instead.
rowDrop(args) {
if (args.dropPosition == "middleSegment") {
args.cancel = true;
}
}

Related

How to Ignore selected rows when filtering using floating filters in ag-grid?

I'm currently working on a project that uses ag-grid in Angular.
We have a table that displays some sort of data and it's possible to filter this table using some textbox floating filters above the table for every column.
Every row has a checkmark in the beginning that can be used to select this row.
The goal is to figure out a way to not filter out the rows that have been selected by the user. The rest of the rows should get filtered as normal.
Is there an easy way to implement this?
I've been looking trough the documentation and it seems like I will have to write a custom filter component, but I'm not sure where to start. Do filters even have the capability to check if a row is selected or not?
So I figured out an easy way. I created a new simple class:
export class IgnoreSelectionFilter extends TextFilter {
doesFilterPass(params: IDoesFilterPassParams): boolean {
if (params.node.isSelected()) return true;
else return super.doesFilterPass(params);
}
}
I use this class as the "filter" component for every column where this functionality is required. This new class behaves exactly like agTextColumnFilter, but first it will verify if the node is selected or not and ignore it if it's selected.

Update chart after changing a field in an APEX form

How do I cause APEX to refresh a chart (graph) after I change the value in a text box/select list/etc that is used as a parameter in the chart's pl/sql statement?
I'd like it to look as professional as possible and minimize the portion of the page that must be refreshed (i.e., "ajax-like", which is the standard in 2018).
Create a dynamic action on the text box/select list/etc that is changed with event "change"
Create a true action and select pl/sql and write
Begin
null;
end;
In page items to submit select your items
Create a second true action after the first and select Refresh. Then select region as affected element and select your chart. Remember that the option 'Fire on initialization' must be set to NO
See Approach B, below, for the optimal solution.
Approach A
The simplest option (that is less professional) is to modify every text box/select list/etc of interest to submit the page when the value of the text box/select list/etc changes. As an example, for the select list, go to its settings->page action on selection and change the setting to submit page.
There are two main downsides to that approach:
Most of the page will refresh, which is jarring to your user, and
If you're using a plugin, or the type of item that you're using doesn't support that approach, then you're out of luck.
Approach B
A more complex solution that yields a more professional result follows. This solution involves dynamic actions, which I will probably not fully explain here. However, the information should be enough for the user to figure it out.
Let us suppose that you have two things: (1) a select list whose value is used as a parameter in a (2) chart's sql source statement.
To get the chart to update every time you make a new choice via the select list, you need to:
Create a dynamic action for the select list of interest. You do this by clicking on the select list, going to the dynamic action tab (the lightning bolt); right-click on the item; click select dynamic action; give it a name and set the event to change and make the selection type an item and set the item to the name of the select list you're watching.
Create a true action for that dynamic action that executes pl/sql code (you can do this by modifying the show action that was created by default in 1.). Set the pl/sql code to null;. Then under items to submit, specify the name of the select list of interest.
Create a second true action that refreshes the region that contains the chart.
You'll need to make sure that the sequence assigned to 2. is a smaller number than the sequence assigned to 3.. This should happen by default, but it's an area you can get tripped up.
Inapplicable Approach C
In Apex 5.something, they added a feature called Cascading List of Values. This feature allows you to specify that one item depends on another item for its values. For example, if you have a select list that allows the user to choose a department, and then you have a second select list that allows you to choose an employee from the chosen department (which presumably obtains its values from a query involving the value chosen in the first select list), you can tell APEX to refresh the second select list whenever you update the first.
You do this by editing the second select list. Under its settings goto list of values->cascading LOV parent item(s). Add the first select list as a "reverse" dependent (aka, "parent"). This will ensure that any time the first select list is updated, the second select list is also updated.
For better or for worse, charts do not have the cascading LOV parent item(s) setting. Thus, this solution does not apply to this question.

Row selection for QLIK Sense table

I have trouble ticket data, with a status field (either Open or Closed).
I'd like to make a sheet that shows graphs (and a table) for data associated with "open" rows - and I don't want a filter to do the subsetting. Graphs on this sheet only make sense for "Open" tickets.
I can do bar charts (I think) with set selection logic.
But I'd also like a table of open tickets, sorted by age.
How can I specify that my table only have rows where status == "Open"?
One way would be to use a calculated dimension.
While editing, create a new Dimension under master items. Then, add an expression like:
If([Status]='Open',[TicketId])
and using it in a table would give you a table with the TicketIds corresponding to Open tickets.
Reference information can be found on the Qlik Sense help site:
http://help.qlik.com/en-US/sense/2.2/Subsystems/Hub/Content/Dimensions/calculated-dimensions.htm
http://help.qlik.com/en-US/sense/2.2/Subsystems/Hub/Content/Dimensions/create-calculated-dimension.htm
Please read the notes on performance, and see whether this solution suits your application.

Interactive sorting of grouped bar chart in D3js

I have generated a group bar chart based on the example provided in D3js.org example repository. Now I am trying to introduce an interactive sorting option based on another example from D3js example sets.
I have three variables grouped per state. I was hoping to provide interaction where reader can sort (descending) based on -
1. Any one of the variables (but whole group should move)
3. Three different sorting options one for each variable (complicated and less important)
I am new to javascript and D3js so I am not sure of the way moving forward. Any suggestion would be greatly appreciated.
Without seeing your code, I can only offer a very vague direction:
you may need a function that gets called, each time the viewer change sorting option. Inside the function, you will need to specify different accessor:
var update = function(_value){
data.sort(function(a, b) { return b._value - a._value; })
// add transition with the newly sorted data
}

APEX - Creating a page with multiple forms linked to multiple related tables... that all submit with one button?

I have two tables in APEX that are linked by their primary key. One table (APEX_MAIN) holds the basic metadata of a document in our system and the other (APEX_DATES) holds important dates related to that document's processing.
For my team I have created a contrl panel where they can interact with all of this data. The issue is that right now they alter the information in APEX_MAIN on a page then they alter APEX_DATES on another. I would really like to be able to have these forms on the same page and submit updates to their respective tables & rows with a single submit button. I have set this up currently using two different regions on the same page but I am getting errors both with the initial fetching of the rows (Which ever row is fetched 2nd seems to work but then the page items in the form that was fetched 1st are empty?) and with submitting (It give some error about information in the DB having been altered since the update request was sent). Can anyone help me?
It is a limitation of the built-in Apex forms that you can only have one automated row fetch process per page, unfortunately. You can have more than one form region per page, but you have to code all the fetch and submit processing yourself if you do (not that difficult really, but you need to take care of optimistic locking etc. yourself too).
Splitting one table's form over several regions is perfectly possible, even using the built-in form functionality, because the region itself is just a layout object, it has no functionality associated with it.
Building forms manually is quite straight-forward but a bit more work.
Items
These should have the source set to "Static Text" rather than database column.
Buttons
You will need button like Create, Apply Changes, Delete that submit the page. These need unique request values so that you know which table is being processed, e.g. CREATE_EMP. You can make the buttons display conditionally, e.g. Create only when PK item is null.
Row Fetch Process
This will be a simple PL/SQL process like:
select ename, job, sal
into :p1_ename, :p1_job, :p1_sal
from emp
where empno = :p1_empno;
It will need to be conditional so that it only fires on entry to the form and not after every page load - otherwise if there are validation errors any edits will be lost. This can be controlled by a hidden item that is initially null but set to a non-null value on page load. Only fetch the row if the hidden item is null.
Submit Process(es)
You could have 3 separate processes for insert, update, delete associated with the buttons, or a single process that looks at the :request value to see what needs doing. Either way the processes will contain simple DML like:
insert into emp (empno, ename, job, sal)
values (:p1_empno, :p1_ename, :p1_job, :p1_sal);
Optimistic Locking
I omitted this above for simplicity, but one thing the built-in forms do for you is handle "optimistic locking" to prevent 2 users updating the same record simultaneously, with one's update overwriting the other's. There are various methods you can use to do this. A common one is to use OWA_OPT_LOCK.CHECKSUM to compare the record as it was when selected with as it is at the point of committing the update.
In fetch process:
select ename, job, sal, owa_opt_lock.checksum('SCOTT','EMP',ROWID)
into :p1_ename, :p1_job, :p1_sal, :p1_checksum
from emp
where empno = :p1_empno;
In submit process for update:
update emp
set job = :p1_job, sal = :p1_sal
where empno = :p1_empno
and owa_opt_lock.checksum('SCOTT','EMP',ROWID) = :p1_checksum;
if sql%rowcount = 0 then
-- handle fact that update failed e.g. raise_application_error
end if;
Another, easier solution for the fetching part is creating a view with all the feilds that you need.
The weak point is it that you later need to alter the "submit" code to insert to the tables that are the source for the view data