Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update volcanotable_client.js #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions lib/volcanotable_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,14 @@
attributes = attributes.join(' ');

switch(input_type) {
case 'text' :
case 'checkbox' :
console.log( input_type+", "+value);
input = '<input type="' + input_type + '" ' + attributes;
if( "true"=== value )
input += ' checked ';
input += ' data-field="' + key + '" value="' + value + '">';
break;
case 'text' :
case 'number' :
input = '<input type="' + input_type + '" ' + attributes + ' data-field="' + key + '" value="' + value + '">';

Expand Down Expand Up @@ -193,7 +199,12 @@
var limit = this.paginationNumber;
var skip = (current_page - 1) * limit;
this.fields = this.settings.fields;

var where2 = this.settings.where;

_.extend(where, where2 || {});

console.log( "%j", where );

var data = {
filter : where,
options : {
Expand All @@ -208,7 +219,9 @@
var passed_template = template.view.parentView.parentView.name;
passed_template = passed_template.replace('Template.', '');

console.log(passed_template);
Meteor.subscribe(passed_template, data);

Meteor.subscribe('VolcanoTableCounts', {
filter : where,
template : passed_template
Expand Down Expand Up @@ -309,8 +322,18 @@
var value = $this.val();
var id = $this.closest('tr').data('record');
var new_data = {};
new_data[key] = value;


if( e.target.type == "checkbox") {
if( e.target.checked)
value = "true";
else
value = "false";
}

new_data[key] = value;


// Don't update when it's a new record
if($this.hasClass('volcanotable-add-input')) {
return;
Expand All @@ -321,7 +344,7 @@
$this.val(template.data.currentDataFieldValue.get());
return;
}

collection.update({ _id : id }, {
$set : new_data
});
Expand Down