Gridview, nhanhang not dropdown

QuestionsGridview, nhanhang not dropdown
BuiDuongThe asked 9 years ago

https://drive.google.com/file/d/0B9u-aHmiNCiBY3hjZkZzaTk4LVk/view

$col = array();
$col["title"] = "Khách Hàng";
$col["name"] = "khachhang";
$col["dbname"] = "wip_workreport.khachhang";
$col["width"] = "20";
$col["align"] = "center";
$col["search"] = true;
$col["editable"] = true;
$col["edittype"] = "select";
$str = $g->get_dropdown_values("select idkh as k, tenkhachhang as v from wip_khachhang");
$col["editoptions"] = array(
"value"=>$str,
"onchange" => array( "sql"=>"select idnh as k, tennhanhang as v from wip_nhanhang WHERE idkhachhang = '{khachhang}'",
"update_field" => "nhanhang" )
);

$col["formatter"] = "select"; // display label, not value
$col["stype"] = "select"; // enable dropdown search
$col["searchoptions"] = array("value" => ":;".$str);
$col["editrules"] = array("number"=>true,"minValue"=>1,"required"=>true);
$cols[] = $col;

$col = array();
$col["title"] = "Nhãn Hàng";
$col["name"] = "nhanhang";
$col["dbname"] = "wip_workreport.nhanhang";
$col["width"] = "20";
$col["align"] = "center";
$col["search"] = true;
$col["editable"] = true;
$col["edittype"] = "select";
$str = $g->get_dropdown_values("select idnh as k, tennhanhang as v from wip_nhanhang");
$col["editoptions"] = array(
"value"=>$str
);
$col["formatter"] = "select"; // display label, not value
$col["stype"] = "select"; // enable dropdown search
$col["searchoptions"] = array("value" => ":;".$str);
$col["editrules"] = array("number"=>true,"minValue"=>1,"required"=>true);
$cols[] = $col;

—————
and Not sum

$col = array();
$col["title"] = "Giá Trị Năm Trước"; // caption of column
$col["name"] = "giatrinamtruoc";
$col["width"] = "25";
$col["formatter"] = "number";
$col["editable"] = true;
$col["editrules"] = array("number"=>true);
$col["formatoptions"] = array("thousandsSeparator" => ",",
"decimalSeparator" => ".",
"decimalPlaces" => 0);
$col["summaryType"] = "sum"; // available grouping fx: sum, count, min, max, avg
$col["summaryTpl"] = '<b>Tổng:{0}đ</b>'; // display html for summary row – work when "groupSummary" is set true. search below
$cols[] = $col;

$col = array();
$col["title"] = "Giá Trị Năm Nay"; // caption of column
$col["name"] = "giatrinamnay";
$col["width"] = "25";
$col["editable"] = true;
$col["editrules"] = array("number"=>true);
$col["formatoptions"] = array("thousandsSeparator" => ",",
"decimalSeparator" => ".",
"decimalPlaces" => 0);
$col["summaryType"] = "sum"; // available grouping fx: sum, count, min, max, avg
$col["summaryTpl"] = '<b>Tổng:{0}đ</b>'; // display html for summary row – work when "groupSummary" is set true. search below
$cols[] = $col;

———————————————

$g->set_columns($cols);
$e["on_data_display"] = array("giatrinamtruoc", null, true);
$e["on_data_display"] = array("giatrinamnay", null, true);
$g->set_events($e);
function giatrinamtruoc($data)
{
$total = 0;
foreach($data["params"] as $d)
{
$total += $d["giatrinamtruoc"];
}

$data["params"]["userdata"] = array("ketthuc"=>"Tổng: ","giatrinamtruoc"=>$total." VNĐ");
}

function giatrinamnay($data)
{
$total = 0;
foreach($data["params"] as $d)
{
$total += $d["giatrinamnay"];
}

$data["params"]["userdata"] = array("ketthuc"=>"Tổng: ","giatrinamnay"=>$total." VNĐ");
}

1 Answers
Abu Ghufran answered 9 years ago

Closing as duplicate of emailed ticket.

Your Answer

10 + 18 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?