Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3309200
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:36:45+00:00 2026-05-17T21:36:45+00:00

I am trying to create a script using FLEXIGRID as a method to display

  • 0

I am trying to create a script using FLEXIGRID as a method to display the information from a database, but I want the users to able to input info into the database as well. I would like to be able to launch a modal window where the user can input the information and submit it. The way the buttons on the FLEXIGRID are coded is as following:

$(document).ready(function(){

 $("#flex1").flexigrid
   (
   {
   url: 'post2.php',
   dataType: 'json',
   colModel : [
    {display: 'ID', name : 'id', width : 40, sortable : true, align: 'center', hide: true},
......
   buttons : [
    {name: 'Add', bclass: 'add', onpress : test},
    {separator: true},
    {name: 'Delete', bclass: 'delete', onpress : test},
    {separator: true},
.... some more code ...

   }
   );   

});
function test(com,grid)
{
    if (com=='Add')
    {
              the code that triggers the modal window
    }
}

Okay, my problem:

When I press ‘Add’, I would like a modal popup window to appear to load using Ajax the content of a local file so the user can input the information.

What I have so far:

I tried using the code from JqModal:
loaded the CSS and Javascript:

<link rel="stylesheet" type="text/css" href="css/jqmodal.css" /> 
<script type="text/javascript" src="js/jqModal.js"></script>
$().ready(function() {
$('#ex2').jqm({ajax: 'examples/2.html', trigger: 'a.ex2trigger'});
});

added the div at the bottom of the page:

<div class="jqmWindow" id="ex2">
Please wait... <img src="inc/busy.gif" alt="loading" />
</div>

but how to trigger the function?

Thanks,
Cristian.

LE: This is the code I have right now and it still doesn’t work:

IE says: Object doesn’t support this property or method flexigrid, line 56 character 5 That’s exactly where the $dialog function starts.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Flexigrid</title>
<link rel="stylesheet" type="text/css" href="css/flexigrid.css" />
<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.7.3.custom.css" />
<script type="text/javascript" src="js/jquery-1.2.3.pack.js"></script>
<script type="text/javascript" src="js/flexigrid.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.3.custom.min.js.js"></script>
<script type="text/javascript">

$(document).ready(function(){

    $("#flex1").flexigrid
            (
            {
            url: 'post2.php',
            dataType: 'json',
            colModel : [
                {display: 'ID', name : 'id', width : 40, sortable : true, align: 'center', hide: true},
                {display: 'URL', name : 'url', width : 450, sortable : true, align: 'left'},
                {display: 'File Name', name : 'filename', width : 270, sortable : true, align: 'left'},
                {display: 'Availability', name : 'availability', width : 50, sortable : true, align: 'center'},
                {display: 'State', name : 'state', width : 40, sortable : true, align: 'center'},
                {display: 'Total Size', name : 'totalsize', width : 90, sortable : false, align: 'center'},
                {display: 'Current Size', name : 'currentsize', width : 90, sortable : false, align: 'center'},
                {display: 'Procent', name : 'procent', width : 40, sortable : true, align: 'center'},
                {display: 'Log',  width : 20, sortable : false, align: 'center'},
                ],
            buttons : [
                {name: 'Add', bclass: 'add', onpress : test},
                {separator: true},
                {name: 'Delete', bclass: 'delete', onpress : test},
                {separator: true},
                {name: 'Select All', bclass : 'selectall', onpress : test},
                {name: 'DeSelect All', bclass : 'deselectall', onpress : test},
                {separator: true}
                ],
            searchitems : [
                {display: 'URL', name : 'url'},
                {display: 'Filename', name : 'filename', isdefault: true}
                ],
            sortname: "state",
            sortorder: "asc",
            usepager: true,
            title: '',
            useRp: false,
            rp: 10,
            showTableToggleBtn: true,
            singleSelect: true
            }
            );   
});
$(document).ready(function() {
    $("#myDialog").dialog({
        autoOpen: false,
        resizable: false,
        position: 'center',
        stack: true,
        height: 'auto',
        width: 'auto',
        modal: true
     });

    $("#showDialog").button().click(function (event) {
        $("#myDialog").dialog('open');
    });
});
function test(com,grid)
{
    if (com=='Add') {
        $("#myDialog").dialog('open');
    }
    if (com=='Select All')
    {
        $('.bDiv tbody tr',grid).addClass('trSelected');
    }

    if (com=='DeSelect All')
    {
        $('.bDiv tbody tr',grid).removeClass('trSelected');
    }

    if (com=='Delete')
        {
           if($('.trSelected',grid).length>0){
               if(confirm('Delete ' + $('.trSelected',grid).length + ' items?')){
                    var items = $('.trSelected',grid);
                    var itemlist ='';
                    for(i=0;i<items.length;i++){
                        itemlist+= items[i].id.substr(3)+",";
                    }
                    $.ajax({
                       type: "POST",
                       url: "delete.php",
                       data: "items="+itemlist,
                       success: function(data){
                        $('#flex1').flexReload();
                        alert(data);
                       }
                    });
                }
            } else {
                return false;
            } 
        }          
} 
</script>
</head>

<body>
<table id="flex1" style="display:none"></table>
<div id="myDialog" style="display:none" title=""></div>
</body>
</html>

LE2: How to load the external file thru ajax:

$(document).ready(function(){
    //define config object
   var dialogOpts = {
        modal: true,
        bgiframe: true,
        autoOpen: false,
        height: 500,
        width: 500,
        draggable: true,
        resizeable: true,
        open: function() {
        //display correct dialog content
        $("#myDialog").load("form.php");}
        };
    $("#myDialog").dialog(dialogOpts);  //end dialog

    $('#showdialog').click(function (event){
            $("#myDialog").dialog("open");
            return false;
        }
    );

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:36:45+00:00Added an answer on May 17, 2026 at 9:36 pm

    The following sample will work with jQuery UI dialog

    First defines the needed markup for the dialog:

    <div id="myDialog" style="display:none" title=""></div>
    

    Then, on DOM ready, setup the dialog to be a jquery UI dialog

    $("#myDialog").dialog({
        autoOpen: false, position: 'center', stack: true, height: 'auto', width: 'auto', modal: true
    });
    

    Please notice the autoOpen: false parameter.

    When you want to show the dialog just call the open method inside of your code

    function test(com,grid) {
        if (com=='Add') {
            $("#myDialog").dialog('open');
        }
    }
    

    hope it helps!

    Update:

    I have created a sample on jsbin.com for you. You can see it working here while you can see the code here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create system users with a php script securely, In that, I'd
I'm trying to create a build script for my current project, which includes an
What I'm trying to do is create a PowerShell script which gets a list
I'm trying to learn bash string handling. How do I create a bash script
Trying to create a user account in a test. But getting a Object reference
Trying to create several layers of folders at once C:\pie\applepie\recipies\ without using several different
I am trying create a WCF service that leverages the WPF MediaPlayer on the
Trying to create a QtRuby application, I get the following error: /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2144: [BUG] Segmentation
Trying to create my first iPhone app that would play back audio. When I
Trying to create a small monitor application that displays current internet usage as percentage

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.