Ajax DataGrid Support Product Page

Solved

I need to create an extra column in ajax datagrid for a checkbox form field.

Reported 11 Jun 2013 18:36:47
1
has this problem
11 Jun 2013 18:36:47 Steve Skinner posted:
I have an existing application for a customer which provides long lists for work orders, and it's pretty sluggish. Each row has a checkbox, allowing the users to click/select a bunch of rows. Once all the work orders they want to print are selected, they just click a button which triggers another page that handles the batch printing.

I want to upgrade this list and use ajax datagrid for its performance with lots of records, but I can't figure out how to add the extra column for the clickable checkbox form field that needs to be on each row.

Is this possible somehow?

Replies

Replied 12 Jun 2013 08:50:58
12 Jun 2013 08:50:58 Miroslav Zografski replied:
Hello Steve,

Yes, it is basically possible, but with some code changes. Or you could have a column in our database to hold a check box code ...
Which one you choose?
Replied 12 Jun 2013 13:43:42
12 Jun 2013 13:43:42 Steve Skinner replied:
Adding a field to my database table just to get a blank column to work with in ajax datagrid seems a little weird. I guess I am more interested in how to make the code changes to make this work.

Thanks!
Replied 03 Jul 2013 16:57:53
03 Jul 2013 16:57:53 Steve Skinner replied:
Hey Miroslav, I am awaiting your reply. You asked which method I wanted and I chose the code changes instead of adding an extra column.

This is actual client work I'm doing here, so your feedback would really be helpful. It's been weeks...
Replied 04 Jul 2013 10:33:50
04 Jul 2013 10:33:50 Miroslav Zografski replied:
Hello Steve,
I'm sorry for the delay.
here is the deal:
You go to your page and open it in code view, then locate the script tag for the Data grid you like to change. The code looks like:
<!--
$(function(){$('#dmx_grid2').flexigrid({
    url: "ajax_servers/dmx_grid2.php",
    title: "asd",
    dataType: "json",
    rpOptions: [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],
    colModel: [{
        display: "event id",
        name: "event_id",
        width: 100,
        sortable: true,
        align: "left",
        hide: false
    },

And so on.
Each column in grid is defined in colModel, so each column has following pattern:
{
        display: "Column Title",
        name: "column_name",
        width: 100,
        sortable: true,
        align: "left",
        hide: false
    }

to have a custom column with image and link you need first to have the code you will need inside the column then you need to add it to the Data grid script in colModel as last columns. and the column need to look like:
{
        display: "Column Title",
        name: "column_name",
        width: 100,
        sortable: true,
        align: "left",
        hide: false,
        before: "<a href=\"mypage.php?with=any&info=you&like=to&pass=here&like={colNumber}\"><!--",
        after: "--><img src="/path/relative/to/root/image.ext"></a>"
    }

Note the html escaping that starts in before and ends in the after - that is set because column content is shown as undefined - as it is such - and this prevents the undefined word from showing.

Regards.
Replied 04 Jul 2013 18:58:59
04 Jul 2013 18:58:59 Steve Skinner replied:
Thanks! This is AWESOME Miroslav! I can't thank you enough for the help.
Replied 26 Jul 2013 18:25:38
26 Jul 2013 18:25:38 phil osullivan replied:
can any one tell me how to remove the 'undefine' that is now in the cell?

here is my code:

{
display: "Column",
name: "column_name",
width: 100,
sortable: true,
align: "left",
hide: false,
before: "<a href=\"#\" class=\"small button secondary\">",
after: "XXX</a>"
}
Replied 29 Jul 2013 07:06:04
29 Jul 2013 07:06:04 Miroslav Zografski replied:
Hello Phil,

Like this:
before: "<a href=\"#\" class=\"small button secondary\"><!--", 
after: "-->XXX</a>" 


Regards.
This reply was removed on 8/23/2013 5:54:56 PM.
See the changelog
Replied 23 Aug 2013 18:02:35
23 Aug 2013 18:02:35 Steve Skinner replied:
Here's a bit more info... I was having trouble getting this to work. Here's the code I put in right below the last column in the colModel based on the instruction:
{
        display: "Indicators",
		name: "indicators",
		width: 200,
		sortable: false,
		align: "left",
		hide: false,
		before: "<a href=\"item.asp?SKU={0}\" target=\"blank\"><!--",
		after: "-->[img]images/key.png"></a>"
	}

Dreamweaver was telling me that I had a syntax error in the line
after: "--><img src="images/key.png"  /></a>"

Just to test, I took out the image tag in the after: line of code and put in some text and the syntax error went away, so it seems that the image tag cannot be entered that way.

After tinkering around with it, I figured out that the image tag must use the back slashes around the double quotes, just like they are used in the href tag. That fixes the problem. So, it actually looks like this:
after: "--><img src=\"images/key.png\"  /></a>"

Reply to this topic