I'm looking for the way how to implement RowUpdated event handler in Answers grid. I've implemented RowUpdated event handler in the value column of the grid but it doesn't work.
I want to concatenate the value of the attribute column value in the description field when I change the value from the drop-down list
Can anyone provide advice please?
protected virtual void CSAnswers_Value_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
}
Works fine on my instance, BUT event will be raised only if
Focus has been changed
Ctrl+Enter pressed
Which is fine from my standpoint. Do you really need to get an event right after the value changing?
Related
Is there a way to hide an entire row, not just a single column, in a grid? I'm tried PXUIField.SetVisible, PXUIField.SetVisibility, PXUISetVisible, and PXUISetVisibility, but none of them seem to work. I know that using PXUIField.SetEnabled(cache, row, false) disabled the entire row, but can I make an entire row invisible?
You need to make sure the row is not returned in the query (could override the view delegate and not return specific rows) or removed from the cache. I don't think there is anything that can hide a row using the UI related calls, but I have never come across the need for this to ever try it.
The usual pattern is to use a PXFilter DataView current DAC record to filter the PXSelect DataView bound to the grid.
The filter fields are often changed on screen directly by the user but you can also set the value of the current filter DAC record programmatically in event handlers to build more complex logic.
public PXFilter<DACFilter> Filter;
public PXSelect<DAC,
Where<DACFilter.field, Equal<Current<DACFilter.fieldFilter>>>> GridDataView;
Is it possible to dynamically hide columns in a grid (using AEF). For example, based on certain conditions I want to hide certain columns in my graph dynamically.
I have used the RowSelectedEvent and have tried to use PXUIField Visibility functionality but it is not hiding the column.
Is there a way to hide the columns from the Graph?
RowSelected should work. Check correctness of what you typed:
1. RowSelected should be protected.
2. Check that you pass into RowSelected PXCache and PXRowSelectedEventArgs
3. Check that in your SetVisible method you pass proper column
4. Check that you pass in method SetVisible proper view
5. Check that you didn't forget to passed not just view but Cache property of view
6. Check that you chosen correct DAC class. Sometime two different DAC classes can represent the same table ( for exapmple APRegister, APInvoice. Or POOrder, POOrder2 )
Here is sample from my working project:
protected void POOrder_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
PXUIFieldAttribute.SetVisible<POOrderExt.allAmt>(this.VendorOrders.Cache, null, false);
//this code hides column in my grid
}
In my acumatica application, I created a custom page where the user needs to insert data in the grid section. In order to validate the provided data, I implemented the RowInserting and RowUpdating Events.
The problem is that in the rowinserting event I first throw an error using the following code:
cache.RaiseExceptionHandling<DZField.size>(fieldLine, fieldLine.Size,
new PXSetPropertyException(string.Format(ValidationMessages.FIELD_NOT_VALID_FORMAT,
"Size"), PXErrorLevel.RowError));
Then I set the e.Cancel property to true. But when the user changes the incorrect value and re-triggers the event, the row will have missing values which were not manipulated in the event.
I also tried to not set the e.Cancel property and instead throw a PXException, but even in this case other values in the row were reset.
In your RowInserting event, you are not throwing an error, you are raising it.
From documentation, the RowInserting event handler is used to:
Evaluate the data record that is being inserted.
Cancel the insert operation by throwing an exception.
Assign the default values to the fields of the data record that is being inserted.
If you use the throw syntax in a row inserting event, a popup window will appear with your error message and the record will not be visible in the grid. You shouldn't use e.Cancel for validations in RowInserting.
Example of cancelling insertion:
protected virtual void DACName_RowInserting(PXCache sender,
PXRowInsertingEventArgs e)
{
throw new PXException(ErrorMessages.FieldIsEmpty,
typeof(PaymentMethodAccount.paymentMethodID).Name);
}
Source: RowInserting Event
Regarding row updating, using e.Cancel for validations will cancel updating of all fields which are marked as dirty for that row. Sometimes that's what you want but based on your question I think that's something you want to avoid.
When validating individual fields you can use the field updating event which will not affect other fields or raise field exceptions. Throwing an error in a row event or setting e.Cancel in a row event will affect the whole row.
It appears to not be possible to programmatically select a specific value in the Kendo DropDownList element. I checked the API, but wasn't able to find something to trigger this.
There is a selectionChange event, but this is triggered by manually selecting a value from the dropdown. I'm interested in programmatically selecting an event; is there any way to do this?
Kendo does not take the new value unless we trigger the change event for the drop-down list. Once we set the value we have to trigger the change event
var menulist = $("#menulist").data("kendoDropDownList");
dropdownlist.value("Top");
dropdownlist.trigger("change");
Add the following to the dropdown html tag: (selectionChange)="selectionChange($event)"
And add the following to your typescript code:
protected selectionChange(value): void {
console.log("The current value is: " + value)
}
To change the selected item from the code behind, use this: http://www.telerik.com/kendo-angular-ui/components/dropdowns/api/DropDownListComponent/#toc-value
I found a solution to implement custom actions for the prev and next buttons in a Fullcalendar.
But I don't know, how I can use it for my case. I want to change the displayed date range of the <p:calendar> if the <p:schedule> switches into the next month/year and the same for the other direction. My construct looks like a simple Outlook Calendar.
I gave the <p:calendar> the possibility to update the <p:schedule>'s initalDate on dateSelect. So the schedule is hopping to the date range of the selected date. But how can I handle the event, if the <p:schedule> has 'month' view and the user decide to go in another month by clicking the prev/next button? The same i got if the user uses <p:calenadar> Buttons and Navigator.
My first idea was to create a ManagedBean which save the state of the current date range. And call an custom event if the previous/next buttons or the navigator get clicked. This event compare the given ranges and update. But I think this isn't possible or is it?
Thanks for your replies.
You have to use a LazyScheduleModel Object to do that
ScheduleModel eventModel = new LazyScheduleModel() {
#Override
public void loadEvents(Date start, Date end) {
handlePreviousNext(start, end);
}
};