Comments (3)
Hi @AjayBarot-BTC, I'm not immediately aware why this would be an issue with CompositeView
or Backbone.View
. Could you provide more context as to how you're reloading model data within a CompositeView
or what method fails such that you have to reload the page? The gist you provided isn't super helpful since it's a lot of code to grok and I can't immediately separate domain logic from behavior.
from backbone-support.
@ecbypi Thanks for a quick reply .
Let me explain the problem in detail
router
({
editItem: function(itemId) {
var assetView, item;
item = this.homeMenu.getItem(itemId);
assetView = ActivityView.create(item.get("activity_type"), {
groups: this.groups,
people: this.people
});
return this.swap(new EditItemView({
model: item,
activityView: assetView,
roles: this.roles,
tags: this.tags,
globalStockImages: this.globalStockImages,
groups: this.groups
}));
}
});
activity_view
this.ActivityView = new PolymorphicFactory("activity view");
Now in item_form asset activity view called by this function
({
renderActivityView: function() {
this.activityView.model = this.model.activity;
this.renderChild(this.activityView);
this.activityView.bind("loading", this.loading, this);
this.activityView.bind("change", this.changeActivity, this);
return this.$(".activity_fields").append(this.activityView.el);
}
});
and submit saved functions are triggered from here
Now in content/activity_view/asset.js
Here I show two check box and configure link as given in image
here I am saving model data by using serialize method :
({
serialize: function() {
return $.extend(this.attributes, {
base_module_ids: this.$('#base_module_ids').val()
});
}
});
Here is my as_json method in model asset.rb
if base_modules
modules_array = []
base_modules.each do |base_module|
modules = {}
modules[:base_module_id] = base_module.id
modules[:modulable_type] = base_module.modulable_type
modules_array << modules
end
result[:base_module_ids] = modules_array
end
result
everything is working expect update base_module scenario
Following is the this.model log after save
After reload (refresh window) base_module_ids shown as a object
Following is the this.model log after refresh window
By reload page we can solved this issue but its taking too much time to reload page in production so we have to improve this.
We are using backbone-on-rails (1.0.0.0) and backbone-support (0.4.0)
You can see whole asset.js (content/activity_view/asset.js) for reference
asset.js
Please tell me if you don't get anything from above code or anything.
Thanks for your support
Thanks & Regards
Ajay Barot
from backbone-support.
Hi @AjayBarot-BTC, the additional code doesn't help me see why CompositeView
would prevent Model#sync()
, Model#fetch()
or any other means of updating a model or collection from behaving correctly.
Could you provide a simplified, reproducible example of the problem independent of the business logic of your app?
from backbone-support.
Related Issues (8)
- Different behaviour Chrome and Firefox when using prop('selectedIndex',-1) HOT 3
- [enhancement] Add missing bower.json.
- Explain if this library is still supported HOT 6
- Deprecation warning - unbindFromAll HOT 4
- Class inheritance is overkill HOT 5
- reorder remove() and _leaveChildren() in leave method under composite_view.js HOT 2
- declaring global Support will fail in strict mode HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backbone-support.