rome icon indicating copy to clipboard operation
rome copied to clipboard

Unknown error in calendar function...

Open ThomasCelen opened this issue 9 years ago • 3 comments

Hi,

I'm trying to implement the datetimepicker, rome-plugin in my rails application but I'm receiving an unkown error. (please know this is the first time that I'm implementing such a plugin) so it might be a basic error.

My view:

<% @properties.where(:location_id => l.id).each do | p | %>
    <tbody>
        <tr>
            ...//removed some other code here to go to the problem //..
            <td data-title="Meeting Slot">
                <input id='input' class='input' />
            <script>rome(input);</script>
            </td>
        </tr>
    </tbody>
<% end %>

The error I'm receiving: Uncaught TypeError: o.appendTo.appendChild is not a function via: calendar.js:67

Line 67 is:

api.back = subtractMonth; This refers to line 1224 of the rome.standalone.js file

What I've done so far:

  1. load Moment.js via the 'momentjs-rails' gem
  2. Create a file rome.standalone.js in my assets/javascript folder with a copy paste of the rome;standalone.js file which can be found on the github page.
  3. added the input and script file on my view.

Anyone who can help me figure out what is wrong?

Many thanks, T

UPDATE: If I paste my view code to the top of the page, outside the table, it gives no error but still doesn't load the datetimepicker...

ThomasCelen avatar Jun 14 '16 15:06 ThomasCelen

I have the same problem. No solution so far.

BastianMorawsky avatar Jul 15 '16 10:07 BastianMorawsky

I'm not sure (yet) how @bevacqua was loading his DOM elements, but you need to pass in a DOM element for the calendar to work. once i changed the argument to rome() to the result of a document.getElementById() call, the calendar worked fine.

dodumosu avatar Sep 02 '16 15:09 dodumosu

to clarify: var input = document.getElementById('myinput'); rome(input); // works fine.

dodumosu avatar Sep 02 '16 15:09 dodumosu