jQWidgets Forums

jQuery UI Widgets Forums Grid Grid, custom buttons & jQuery mobile popup

This topic contains 0 replies, has 1 voice, and was last updated by  jas- 11 years, 6 months ago.

Viewing 1 post (of 1 total)
  • Author

  • jas-
    Member

    I am attempting to create a custom button such as used in the example @ statusbar.

    What I would like to do is to bind the button to the jQuery mobile popup as seen in the examples here.

    Here is the code I am working with and not having any luck. Any tips, help, pointers is appreciated.

    $("#"+element).jqxGrid({
      altrows: true,
      autoheight: true,
      autosavestate: true,
      autoshowloadelement: true,
      autoloadstate: true,
      columns: obj.columns,
      editable: true,
      filterable: true,
      groupable: true,
      pageable: true,
      pagesizeoptions: ['5', '10', '20', '30', '40', '50'],
      ready: function () {
        $('#'+element).jqxGrid('loadstate', $('#'+element).jqxGrid('getstate'));
      },
      renderstatusbar: function (statusbar) {
        statusbar.append(getBtns(element, statusbar));
      },
      selectionmode: 'singlecell',
      showfilterrow: true,
      showstatusbar: true,
      showtoolbar: true,
      source: adapter,
      sortable: true,
      updaterow: function (rowid, rowdata, commit) {
        /* update record */
        commit(true);
      },
      width: '100%'
    });

    As you can see the “renderstatusbar” calls “getBtns()” along with corresponding functions can be seen here…

    function getBtns(element, obj)
    {
      var AddBtn = genAddBtn();
    
      var container = genBtnContainer();
    
      container.append(AddBtn);
    
      btnEvents(element, AddBtn);
    
      return container;
    }
    
    function btnEvents(element, AddBtn)
    {
      AddBtn.jqxButton({
        width: 65,
        height: 20
      });
    }
    
    function genBtnContainer()
    {
      return $("<div style='overflow: visible; position: relative; margin: 5px;'></div>");
    }
    
    /* Add button */
    function genAddBtn()
    {
      return $("<div style='float: left; margin-left: 5px;'>"+
        "<a href='#add-computer' data-rel='popup' data-position-to='window' data-role='button' data-inline='true'>"+
          "<img style='position: relative; margin-top: 2px;' src='../images/add.png'/>"+
            "<span style='margin-left: 4px; position: relative; top: -3px;'>"+
              "Add"+
            "</span>"+
          "</a>"+
        "</div>");
    }
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.