I have this bit of code that I use to edit input fields. The example I was given is something like:
editCellStarted: function ( evt, ui ) { var input = $( "input.ui-igedit-field" );
... do stuff.
I ran in to an issue when I use a pop out feature we created to copy the entire div and put it in to a new window. The problem is that the new window does not understand the css "input.ui-igedit-field" . So input is null. Unfortunately I dont know enough about that line to make this work. I'm guessing it makes a Jquery object form the css on a cell. Since my new pop up page does not have access to a "input.ui-igedit-field" I need to make this code work another way.
full code:
editCellStarted: function ( evt, ui ) { var input = $( "input.ui-igedit-field" ); setTimeout( function () { //if we have a keypress in the buffer replace the text otherwise move the cursor. if ( INSTANCE.cellSelectionEditModeAscii != null ) { input.val( INSTANCE.cellSelectionEditModeAscii ) } else { input.val( INSTANCE.oldEditValue ); input.prop( "selectionStart", input.val().length ).select(); } INSTANCE.cellSelectionEditModeAscii = null; document.getElementById( "myContentValue" + INSTANCE.ID ).value = input.val(); }, 150 ); },
Hello,
Thank you for contacting us.
As I understand you want to select some input value, and you use normal CSS selector in order to achieve this, although the result is null? Can I ask you where this input is placed and also this .ui-igedit-field CSS class applies to Input fields that are wrapped with our igEditor widget, do you use something similar in your sample? My suggestion is to select the input by unique ID, unless you want to select more than one input's.
Below you can find a couple of articles regarding jQuery selectors:
http://stackoverflow.com/questions/10649869/jquery-selector-inputtype-text
http://stackoverflow.com/questions/14243088/in-css-is-there-a-selector-for-referencing-a-specific-input-type-that-also-has-a
http://stackoverflow.com/questions/1065925/jquery-selecting-by-class-and-input-type
Also could you please send me a small sample that is representing the issue or show me a code snippet, this will be highly appreciated.
I think I failed to explain the problem but I will look at the selector examples a bit an hope to resolve this. For clarification this code works. There is nothing wrong with this code at all. The problem is that I copy my grid in to another window. For whatever reason, this does not copy the selectors.
this is how I copy in the div and styles, maybe there is a way to copy in the selectors?
for ( var i = 0, max = linkrels.length; i < max; i++ ) { //copy in styles. if ( linkrels[i].rel && linkrels[i].rel == 'stylesheet' ) { var thestyle = document.createElement( 'link' ); var attrib = linkrels[i].attributes; for ( var j = 0, attribmax = attrib.length; j < attribmax; j++ ) { thestyle.setAttribute( attrib[j].nodeName, attrib[j].value ); } this.document.documentElement.appendChild( thestyle ); } }
after that I append my div. This makes my new window hold a matching div with its styles. I also copy in my events and what not.
Using the same logic but for
var selectors = document.getElementsByTagName( 'select' );
didn't work.