locked
fix or workaround for HTML client "textbox in table cannot enter space character" ? RRS feed

  • Question

  • I'm seeing the same issue reported in the comments of the September 2013 blog post about the HTML Client's Table control.  Specifically, I have a textbox within the table, but trying to enter text into the textbox works fine for non-space characters, but trying to enter a space fails because it appears to be getting intercepted (and changing the current focus)

    http://blogs.msdn.com/b/lightswitch/archive/2013/09/11/the-lightswitch-html-table-control-rohit-agrawal.aspx

    It is easy to make the grid editable (it has set use-readonly-controls) by flipping labels to textboxes. Unfortunately as the control intercepts SPACEBAR for tap it out-of-the-box means that you cannot enter a space into a textbox. Which way is edit support going, trash can or fix? Apart from that very nice!

    I'm using VS 2013 Update 3, and it's a normal Table and a normal textbox within it - no third-party controls or extensions being used.

    Is there something I can do as a workaround, or is there a fix available for this?

    Thanks!

    Wednesday, September 10, 2014 6:59 PM

Answers

  • HI James,

    Thanks for your feedback.

    As your description above, we can't enter a space into textbox. I test it on my side, but I don't find alternative to do that, I'd like to suggest you to submit this request to Visual Studio UserVoice Site, this site is for suggestions and ideas, Visual Studio team will take this into consideration. 

    Best regards,

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Angie Xu Thursday, September 25, 2014 6:40 AM
    Thursday, September 18, 2014 10:00 AM

All replies

  • HI James,

    Thanks for your feedback.

    As your description above, we can't enter a space into textbox. I test it on my side, but I don't find alternative to do that, I'd like to suggest you to submit this request to Visual Studio UserVoice Site, this site is for suggestions and ideas, Visual Studio team will take this into consideration. 

    Best regards,

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Angie Xu Thursday, September 25, 2014 6:40 AM
    Thursday, September 18, 2014 10:00 AM
  • Does anybody know if this has been resolved or a workaround found? I find this also happens for a textbox within a Tile.
    Wednesday, January 28, 2015 3:15 PM
  • I don't have a 'good' workaround, but I ended up hacking around it by using the debugger to find the places processing the space character to do selection and removing them (unfortunately don't have a diff handy, or I'd point to the particular places).   If you'd rather avoid that, you should be able to have double-click/double-tap open an edit dialog for the item and then the textbox in that popup/dialog shouldn't have any such problems with spaces being entered.
    Wednesday, January 28, 2015 3:37 PM
  • James,

    Appreciate the reply.  After posting I worked around it like you mention, creating a popup for users to modify the data.

    Thanks again,

    Billy

    Wednesday, January 28, 2015 6:34 PM
  • In case it's any help, I ended up having to dig up the fixes for this.  Both changes are in msls-2.5.1.js (if you have a different version, the right fix might be different)

    The first is the actual entering-space-in-the-textbox fix - in function addItemEventHandlers(table) around line 28578

    The second was needed because when I would click inside the textbox on a line, the focus logic would then steal the focus away from the textbox and focus the entire line instead.

    Wednesday, February 4, 2015 1:27 AM
  • James

    This almost worked for me but after the second time pressing the spacebar (ie the third word typed) it would focus on the row again.  Any suggestions?

    Monday, July 13, 2015 9:35 PM
  • I've been using the following, per table, on the post render of the grid/list:

    function enableSpaceonList(element) {
        $(element).keydown(function (e) {
            if (e.which === $.mobile.keyCode.SPACE) {
                e.stopPropagation();
            }
        });
    }

    I'd like to give proper credits for this but i can't remember where/who posted this.

    EDIT  - From Xpert360(Didn't notice the other thread) https://social.msdn.microsoft.com/Forums/vstudio/en-US/840d9d33-5955-4529-853a-0afcac79b201/lightswitch-html-client-vs-2013-rc-text-entry-issues?forum=lightswitch

    I used to prefer this in order not to mess with the msls but maybe that's not that very relevant in the current LS status.

    Another fix i have is to remove the sort on a column. I have some cases where I like to have a column with a Columns Layout with, say, 2 or three buttons on it. Like this:

     

    If one clicks on the Header the world explodes. So this is what I have, using it on the table's post render (passing the element and the intended index to remove the click):

    function removeHeaderClick(element, index) {
        $(element).find('th:eq(' + index + ')').click(function () { return false; });
        $(element).find('th:eq(' + index + ')').parent().off('click');
    }
    Little off-road but might be usefull :)


    Monday, July 13, 2015 10:12 PM