I managed to create a TableView with specific columns assigned to a datamodel-class. The program can parse a csv file into it and shows everything correctly in the table. Scrolling isnt a problem at this stage.
Then I want to select specific rows and send them to another table. Which works as well. But when I start scrolling in table1 again the content outside the visual area is disappeared.
I dont really understand what happened here because I didn't changed anything for table1. Both lists are using Order as datamodel... perhaps this is a problem? Here is the code which sends the rows to table2:
if(init) { //init is true
ObservableList<TableColumn<Order, ?>> header = table1.getColumns();
table2.getColumns().addAll(header);
table2.setItems(table2Observable);
init = false;
}
table2Observable.addAll(table1.getSelectionModel().getSelectedItems());
table2.setItems(table2Observable);
if order is your bean class then override the hashcode() and equals() method properly. This is occurring because of the duplicate object. It worked for me.
Related
I have 2 select controls. One change event updates the other. Also, it updates a grid inside update panel.
On page load, I call an ajax method to get the drop down values for both select. I populate the control and trigger a button click event which then updates the grid inside the update panel.
Everything works fine in all browsers, except in Firefox. Any idea as to why this might be happening?
Upon using break point i discovered that in other browsers the server side method is called first and then the ajax method while in Firefox its the other way around.
I narrowed down the issue to when using EndRequestHandler. I use EndRequestHandler event to change the class for a control. I remove that functionality and its perfect. The code for it is below:
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function EndRequestHandler()
{
var type = $('[id$=ddlType]').val();
$('a[data-categoryid="' + type + '"').parent().addClass('selected');
}
Finally, there was a typo in my code. I forgot the closing square bracket in the EndRequestHandler. Surprisingly, the other browsers didn't care about it!
Updated code.
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function EndRequestHandler()
{
var type = $('[id$=ddlType]').val();
$('a[data-categoryid="' + type + '"]').parent().addClass('selected');
}
I have a very big handsontable. I have dropdown columns defined, but, the values for the sources are retrieved with AJAX.
How can I set the "source" property of a "column" of type "dropdown" dynamically?
Regards!
You can, and should, use:
hotInstance.updateSettings({
columns: getNewColumns()
})
Where getNewColumns() would return an array of columns with the data and new source (or make the AJAX call from in here). That should do it!
Thank you for the answer ZekeDroid.
I was able to solve my issue.
First lets talk about a problem in the angular directive:
I am using the handsontable's angular directive. Two things happen: 1. If I associated the datarows attribute to a nested variale in the model, for example $scope.hot.data, then when I change the value of the model ( $scope.hot.data ) the grid ui is not refreshed. I am pretty sure this is an issue with the directive. Now: 2. Assume I use $scope.data and I update its value (this is the model right), then the grid ui is not refreshed either. I have to do something like hotInstance.updateSettings({data: newData}) as well.
I have to do both things; that is, update the model and call the update settings method. This is the only way I could get it work properly.
Note: if I do $scope.$apply() instead the updateSettings, I get an error in the console.
I’m hoping someone can shed some light on this:
I’m using the search facility in Magento to find products with a certain attribute, and then selecting those products and using the “update attributes” feature to add data to (update) a different attribute field.
In some cases, this works fine, the new attribute data is recorded and all is well. On other selections when I try and save the new attribute data it comes up with the red warning “this is a required field”. Sure enough, the field it specifies IS a required field, but as I’m not updating that particular field I’ve not ticked the check box underneath it and this field should be ignored.
If I turn off the “required field” option for the highlighted fields then the new attribute data gets saved BUT: It wipes the data in loads of the other attributes, meaning I lose valuable data from my product attributes. It seems as if it works the first couple of times I use it in a day then it spits its dummy out and comes up with the required field issue.
I’ve tried this with both Google Chrome and Firefox. As I’ve said though, sometimes it will work , sometimes it won’t . I’m selecting 20-100 products at a time. I’ve even tried selecting just one product, and can still get the same error on that one product.
I’m on Magento 1.7.0.2
I did have a similar problem with attribute data getting wiped last year when we were on 1.6 but I seem to remember it was a Magento bug which was fixed when we upgraded to a newer version.
Can anyone shed any light on why this might be happening? There’s nothing coming up in the search engines for it and its really slowing me down!
The problem is that the attributes are NOT getting disabled by default in the update attributes page, hence require a value.
Why?
Most likely due to a faulty attribute failing somewhere above your attribute.
Option 1. As I don't know what attribute or the attribute problem, hack js/mage/adminhtml/product.js and change this function to ignore the faulty attribute.
function disableFieldEditMode(fieldContainer) {
try {
$(fieldContainer).disabled = true;
if ($(fieldContainer + '_hidden')) {
$(fieldContainer + '_hidden').disabled = true;
}
}
catch(exception) {
}
}
Option 2. Remove the faulty attribute from the product (You might need to remove restrictions ).
update eav_attribute set is_user_defined = 1 where attribute_code like 'foo_bar';
Option 3. Fix the faulty attribute. In my case the offending module was AW_Onsale.
it attempted to render a nonexistent frontend model: onsale/system_entity_form_element_position
select attribute_code, frontend_model from eav_attribute where attribute_code like '%aw_os_%';
aw_os_product_position | onsale/entity_attribute_frontend_position
update eav_attribute set frontend_model = null where attribute_code like '%aw_os_product_position%';
update eav_attribute set frontend_model = null where attribute_code like '%aw_os_category_position%';
I have a composite view which has a task, and it's comments. I put it onto a contentRegion to display. When rendering model alone, it works fine. However when come to collection, it behaves really strange. console.log shows initialize function has been triggered twice. The first time is when define the view
taskView = new MyProject.Views.Task
model : task
collection : comments
I then do a MyProject.contentRegion.show(taskView) in order to render the model view. After that, I just call comments.fetch() to get all the comments. Then comes the problem, it re-initialized my taskView and the template keep complaining xxx is undefined.
Any thoughts? I know it's weird because another CompositeView in my project works great.
NathanInMac, I've done a little testing from your suggestion of using an itemView and found some interesting stuff.
Was your problem involving nested compositeviews'? As mine was but I'm unsure if that affects anything.
What solved the problem was initially trying a collectionView which couldn't find the itemView so I moved the definition of the itemView for the collectionView/compositeView to before the definition of the collectionView(or extended).
This seems to be a working fix and just a misleading bug with compositeView's double initializing instead of displaying some exception or error.
This should be quite a common problem, but I couldn't find anything helpful on the topic.
We are developing an application with Eclipse RCP. The application shows data in an editor of which usually multiple instances are open. In an additional view you can edit the editor-values. When the values are changed in the view they are updated in the editor and it's dirty flag is set.
So far it works fine. What we're missing is: When another editor instance gets the focus, our view should show the data of this editor.
I managed to do that for two views. The second view is sucessfully updated using a TableViewer as selection Provider and registering a SelectionListener in the other view. I tried the same thing for the editor using a Viewer I subclassed from ContentViewer, but it didn't work.
Can this approach be working?
Or do I need a different approach on the problem?
May be you can subclass your view from PageBookView and then provide special adapter for your editor. Outline View is implemented using this approach.
Thank you cerealk, that was exactly what I needed. :-)
Update the View when another Editor is selected
public class myView {
// Create an IPartListener2
IPartListener2 pl = new IPartListener2() {
// If the Editor I'm interested in was updated ...
public void partActivated(IWorkbenchPartReference ref) {
IWorkbenchPart part = ref.getPart(true);
if (part instanceof DetailEditor) {
// ... update the view
Contact contactFromSelectedEditor = ((DetailEditor) part).detailComposite.contact;
detailComposite.update(contactFromSelectedEditor);
}
}
...
}
// Add the IPartListener2 to the page
IWorkbenchPage page = this.getSite().getPage();
page.addPartListener(pl);
}
Why use an IPartListener2 instead of an IPartListener
The IPartListener2 replaces IPartListener with 3.5.
As explained in this this answer:
You should always use IPartListener2 as it can handle part-change events on parts that have not yet been
created because they are hidden in a stack behind another part.
This
listener will also tell you when a part is made visible or hidden or
when an editor's input is changed.