0
Answer

Merge Jquery Grid Two cells has the same values together

Mansour SHaaban

Mansour SHaaban

11y
1.4k
1

I have one Jquery Grid ,

binded data from DB,

the issue is i need to merge cells in column one that has the same values toegter.

Below is my code

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
    <!-- The jQuery UI theme that will be used by the grid -->
    <link rel="stylesheet" type="text/css" media="screen" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.0/themes/excite-bike/jquery-ui.css" />
    <!-- The jQuery UI theme extension jqGrid needs -->
    <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" />
    <!-- jQuery runtime minified -->
    <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.9.0.min.js" type="text/javascript"></script>
    <!-- The localization file we need, English in this case -->
    <script src="js/trirand/i18n/grid.locale-en.js"type="text/javascript"></script>
    <!-- The jqGrid client-side javascript -->
    <script src="js/trirand/jquery.jqGrid.min.js" type="text/javascript"></script>
	
    <style type="text/css">
.ui-jqgrid tr.jqgrow td{height:100px; font-size:large; font-weight:bold;}
$("#grid").closest("div.ui-jqgrid-view")
    .children("div.ui-jqgrid-titlebar")
    .css("text-align", "center")
    .children("span.ui-jqgrid-title")
    .css("float", "none");

</style>
    
    <style type="text/css">
        
        body { font-size: 75px; }
    </style>
</head>

<body >
    <form id="form1" runat="server">
    
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ connection string value %>"
        SelectCommand="select distinct M.MINOR_NM [SVC Type],'In Warranty' WTY,
(select count(*) Total from w_job_header_usg105 a where  a.job_status&lt;'60'   and a.Cost_type='W1' and Service_type in ('T1')) Total,
(select count(*)  from w_job_header_usg105 A where a.job_status&lt;'60' and a.Service_type in ('T1') and DateDiff(dd ,CONVERT(VARCHAR(10),a.RECEIPT_DT,120),getdate())&lt;=3 and  Cost_type='W1' ) '0~3 Days',
(select count(*)  from w_job_header_usg105  where   job_status&lt;'60' and Service_type in ('T1') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;3 and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&lt;=7 and  Cost_type='W1' ) '4~7 Days',
(select count(*)  from w_job_header_usg105 where   job_status&lt;'60' and Service_type in ('T1') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;7 and  Cost_type='W1' ) 'Over 7 Days'
from mytabe1 J join mytabe2 M on J.Service_type=M.Minor_cd and M.Major_cd='WA003'and J.Service_type in ('T1')

 Union

select distinct M.MINOR_NM [SVC Type],'Out Of Warranty' WTY,
(select count(*) Total from w_job_header_usg105 a where  a.job_status&lt;'60'   and a.Cost_type in('W6','') and Service_type in ('T1')) Total,
(select count(*)  from w_job_header_usg105 A where a.job_status&lt;'60' and a.Service_type in ('T1') and DateDiff(dd ,CONVERT(VARCHAR(10),a.RECEIPT_DT,120),getdate())&lt;=3 and  Cost_type in ('W6','')) '0~3 Days',
(select count(*)  from w_job_header_usg105  where   job_status&lt;'60' and Service_type in ('T1') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;3 and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&lt;=7 and  Cost_type in ('W6','')) '4~7 Days',
(select count(*)  from w_job_header_usg105 where   job_status&lt;'60' and Service_type in ('T1') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;7 and  Cost_type in ('W6','') ) 'Over 7 Days'
from W_JOB_HEADER_USG105 J join B_MINOR M on J.Service_type=M.Minor_cd and M.Major_cd='WA003'and J.Service_type in ('T1')
Union

select distinct M.MINOR_NM [SVC Type],'In Warranty' WTY,
(select count(*) Total from w_job_header_usg105 a where  a.job_status&lt;'60'   and a.Cost_type='W1' and Service_type in ('T4')) Total,
(select count(*)  from w_job_header_usg105 A where a.job_status&lt;'60' and a.Service_type in ('T4') and DateDiff(dd ,CONVERT(VARCHAR(10),a.RECEIPT_DT,120),getdate())&lt;=3 and  Cost_type='W1' ) '0~3 Days',
(select count(*)  from w_job_header_usg105  where   job_status&lt;'60' and Service_type in ('T4') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;3 and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&lt;=7 and  Cost_type='W1' ) '4~7 Days',
(select count(*)  from w_job_header_usg105 where   job_status&lt;'60' and Service_type in ('T4') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;7 and  Cost_type='W1' ) 'Over 7 Days'
from W_JOB_HEADER_USG105 J join B_MINOR M on J.Service_type=M.Minor_cd and M.Major_cd='WA003'and J.Service_type in ('T4')

 Union

select distinct M.MINOR_NM [SVC Type],'Out Of Warranty' WTY,
(select count(*) Total from w_job_header_usg105 a where  a.job_status&lt;'60'   and a.Cost_type in('W6','') and Service_type in ('T4')) Total,
(select count(*)  from w_job_header_usg105 A where a.job_status&lt;'60' and a.Service_type in ('T4') and DateDiff(dd ,CONVERT(VARCHAR(10),a.RECEIPT_DT,120),getdate())&lt;=3 and  Cost_type in ('W6','')) '0~3 Days',
(select count(*)  from w_job_header_usg105  where   job_status&lt;'60' and Service_type in ('T4') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;3 and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&lt;=7 and  Cost_type in ('W6','')) '4~7 Days',
(select count(*)  from w_job_header_usg105 where   job_status&lt;'60' and Service_type in ('T4') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;7 and  Cost_type in ('W6','') ) 'Over 7 Days'
from W_JOB_HEADER_USG105 J join B_MINOR M on J.Service_type=M.Minor_cd and M.Major_cd='WA003'and J.Service_type in ('T4')

Union
select distinct M.MINOR_NM [SVC Type],'In Warranty' WTY,
(select count(*) Total from w_job_header_usg105 a where  a.job_status&lt;'60'   and a.Cost_type='W1' and Service_type in ('T2')) Total,
(select count(*)  from w_job_header_usg105 A where a.job_status&lt;'60' and a.Service_type in ('T2') and DateDiff(dd ,CONVERT(VARCHAR(10),a.RECEIPT_DT,120),getdate())&lt;=3 and  Cost_type='W1' ) '0~3 Days',
(select count(*)  from w_job_header_usg105  where   job_status&lt;'60' and Service_type in ('T2') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;3 and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&lt;=7 and  Cost_type='W1' ) '4~7 Days',
(select count(*)  from w_job_header_usg105 where   job_status&lt;'60' and Service_type in ('T2') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;7 and  Cost_type='W1' ) 'Over 7 Days'
from W_JOB_HEADER_USG105 J join B_MINOR M on J.Service_type=M.Minor_cd and M.Major_cd='WA003'and J.Service_type in ('T2')

 Union

select distinct M.MINOR_NM [SVC Type],'Out Of Warranty' WTY,
(select count(*) Total from w_job_header_usg105 a where  a.job_status&lt;'60'   and a.Cost_type in('W6','') and Service_type in ('T2')) Total,
(select count(*)  from w_job_header_usg105 A where a.job_status&lt;'60' and a.Service_type in ('T2') and DateDiff(dd ,CONVERT(VARCHAR(10),a.RECEIPT_DT,120),getdate())&lt;=3 and  Cost_type in ('W6','')) '0~3 Days',
(select count(*)  from w_job_header_usg105  where   job_status&lt;'60' and Service_type in ('T2') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;3 and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&lt;=7 and  Cost_type in ('W6','')) '4~7 Days',
(select count(*)  from w_job_header_usg105 where   job_status&lt;'60' and Service_type in ('T2') and DateDiff(dd ,CONVERT(VARCHAR(10),RECEIPT_DT,120),getdate())&gt;7 and  Cost_type in ('W6','') ) 'Over 7 Days'
from W_JOB_HEADER_USG105 J join B_MINOR M on J.Service_type=M.Minor_cd and M.Major_cd='WA003'and J.Service_type in ('T2')">
    </asp:SqlDataSource>
    
    <trirand:JQGrid runat="server" ID="JQGrid1" DataSourceID="SqlDataSource1"
        Height="100%" KeyboardNavigation="False" Width="1310px" AutoWidth="True" onprerender="JQGrid1_PreRender"
        >
        
        <TreeGridSettings Enabled="True" />
        <ViewRowDetailsDialogSettings Caption="Pending Jobs Report" />
        <AppearanceSettings Caption="Pending Jobs" />
        <Columns>
            <trirand:JQGridColumn DataField="SVC Type" Searchable="False" Sortable="False"
                TextAlign="Center" CssClass= "ui-jqgrid" />
            <trirand:JQGridColumn DataField="WTY" TextAlign="Center" />
            <trirand:JQGridColumn DataField="Total" TextAlign="Center" />
            <trirand:JQGridColumn DataField="0~3 Days" TextAlign="Center" />
            <trirand:JQGridColumn DataField="4~7 Days"  TextAlign="Center">
            </trirand:JQGridColumn>
            <trirand:JQGridColumn DataField="Over 7 Days" TextAlign="Center" >
            </trirand:JQGridColumn>
        </Columns>
        <SearchDialogSettings Draggable="False" />
    </trirand:JQGrid>
    
    
    </form>
</body>
</html>

The resut comes as below