populate

Struts 2: updating a list of objects from a form with model driven architecture

百般思念 提交于 2019-11-29 10:52:53
I already searched and found several approaches here, but I can't get them working for my project. I want to show an edit page for a list of objects, which should all be updated at once. I use the model driven architecture approach to achieve this, but I can't get it running properly. I can always display and iterate the list and its values, but I can't modify its values. So here is what I'm currently doing: I have a Model 'Teilzeitgrad' in my database, which has some simple attributes with getters and setters. public class Teilzeitgrad { private Date datumAb; private Date datumBis; private

symfony2 - adding choices from database

China☆狼群 提交于 2019-11-29 09:25:46
问题 I am looking to populate a choice box in symfony2 with values from a custom query. I have tried to simplify as much as possible. Controller class PageController extends Controller { public function indexAction() { $fields = $this->get('fields'); $countries = $fields->getCountries(); // returns a array of countries e.g. array('UK', 'France', 'etc') $routeSetup = new RouteSetup(); // this is the entity $routeSetup->setCountries($countries); // sets the array of countries $chooseRouteForm =

Dropdown populate ajax

一个人想着一个人 提交于 2019-11-28 14:05:37
I have the following issue: When i select an element from a drop down i want to auto populate another drop down via ajax. the idea is that the subcategory(sub_type) doesn't load after selecting the "type". HTML <select id="type" name="type"> <option value="1">General</option> <option value="2">Test</option> </select> <select id="sub_type" name="sub_type"> </select> SCRIPT $("#type").change(function(){ $.getJSON("ajax/add_subcathegory.php",{id: $(this).val(), ajax: 'true'}, function(j){ var options = ''; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].id+ '">' + j[i]

Mongoose: Cast to ObjectId failed for value

时光怂恿深爱的人放手 提交于 2019-11-28 13:25:46
I'm trying to specify the schema of my db in mongoose. At the moment I do this: var Schema = mongoose.Schema; var today = new Date(2011, 11, 12, 0, 0, 0, 0); var personSchema = new Schema({ _id : Number, name: { type: String, required: true }, tel: { type: String, required: true }, email: { type: String, required: true }, newsitems: [{ type: Schema.Types.ObjectId, ref:'NewsItem'}] }); var taskSchema = new Schema({ _id: Number, description: { type: String, required: true }, startDate: { type: Date, required: true }, newsitems: [{ type: Schema.Types.ObjectId, ref:'NewsItem'}] }); var newsSchema

Save using JFileChooser with pre-populated file name?

百般思念 提交于 2019-11-28 11:07:12
问题 I am trying to make saving and loading easier for some GUIs that I've made, and I would like to be able to pre-populate a filename for the user on save. Getting the JFileChooser to point at a convenient directory is easy enough, but pre-populating the name doesn't seem so easy. Currently, my code is: JFileChooser f = new JFileChooser(); f.setSelectedFile(new File(generateName())); This actually appears to work at first: The filename is populated in the JFileChooser, but when clicking the save

Sails.js populate with where

断了今生、忘了曾经 提交于 2019-11-28 08:41:59
问题 I need to select users with dogs (pets with type equal 'dog') var User = Waterline.Collection.extend({ identity: 'user', attributes: { firstName: 'string', lastName: 'string', pets: { collection: 'pet', via: 'owner' } } }); var Pet = Waterline.Collection.extend({ identity: 'pet', attributes: { type: 'string', name: 'string', owner: { model: 'user' } } }); I didn't find any examples, I tried like this User.find().populate('pets', {type: 'dog'}).exec(err, users) ... and this User.find().where({

Struts 2: updating a list of objects from a form with model driven architecture

 ̄綄美尐妖づ 提交于 2019-11-28 04:44:16
问题 I already searched and found several approaches here, but I can't get them working for my project. I want to show an edit page for a list of objects, which should all be updated at once. I use the model driven architecture approach to achieve this, but I can't get it running properly. I can always display and iterate the list and its values, but I can't modify its values. So here is what I'm currently doing: I have a Model 'Teilzeitgrad' in my database, which has some simple attributes with

How to populate a TableView that is defined in an fxml file that is designed in JavaFx Scene Builder

て烟熏妆下的殇ゞ 提交于 2019-11-27 20:07:51
I would like to know how do I populate a TableView with data... All the examples I have seen creates a TableView with columns and everything and add it to the scene. All done in the java code itself. What I want to know: if I design my "form" in JavaFx Scene builder. Defining all the tables and columns in there. How do I access it to populate it from java? Or if someone can point me to a proper tutorial on this please. I have defined my form in JavaFx Scene Builder - only a TableView with 3 Columns <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import

Mongoose populate after save

爱⌒轻易说出口 提交于 2019-11-27 17:19:33
I cannot manually or automatically populate the creator field on a newly saved object ... the only way I can find is to re-query for the objects I already have which I would hate to do. This is the setup: var userSchema = new mongoose.Schema({ name: String, }); var User = db.model('User', userSchema); var bookSchema = new mongoose.Schema({ _creator: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }, description: String, }); var Book = db.model('Book', bookSchema); This is where I am pulling my hair var user = new User(); user.save(function(err) { var book = new Book({ _creator: user, });

Mongoose: deep population (populate a populated field)

无人久伴 提交于 2019-11-27 11:18:20
I have Category model: Category: ... articles: [{type:ObjectId, ref:'Article'}] Article model contains ref to Account model . Article: ... account: {type:ObjectId, ref:'Account'} So, with populated articles Category model will be: { //category articles: //this field is populated [ { account: 52386c14fbb3e9ef28000001, // I want this field to be populated date: Fri Sep 20 2013 00:00:00 GMT+0400 (MSK), title: 'Article 1' } ], title: 'Category 1' } The questions is: how to populate subfield (account) of a populated field ([articles])? Here is how I do it now: globals.models.Category .find issue :