Telerik Forums
Kendo UI for jQuery Forum
5 answers
363 views
So here is the problem.

I have a grid which need to make an update through POST and not GET. SO I am doing this on Save event. Everything works fine with inline editing. But with PopUp editing I do not get referance to model. So in function " save: function (e)" below e.model is undefined. However it comes up fine in case of inline.

If there is better way to update the drid through POST then I am open to it.

here is the code:

 dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: URL,
                        dataType: "jsonp"
                    },
                    update: {
                        url: "",
                        dataType: "jsonp"
                    },
                    destroy: {
                        url: "",
                        dataType: "jsonp"
                    },
                    create: {
                        url: "",
                        dataType: "jsonp"
                    },
                    parameterMap: function (options, operation) {
                        if (operation !== "read" && options.models) {
                            return { models: kendo.stringify(options.models) };
                        }
                    }
                },
                batch: true,
                pageSize: 10,
                schema: {
                    model: {
                        id: "PROJECT_ID",
                        fields: {
                            "PROJECT_ID": { editable: false, nullable: true },
                            "PROJECT_NM": { validation: { required: true} },
                            "PROJECT_DESC": { validation: { required: true} },
                            "ACTIVE_IND": { type: "boolean" }
                        }
                    }
                }

            });

 

//GRID
$("#grid").kendoGrid({
                dataSource: dataSource,
                pageable: true,
                height: 400,
                toolbar: ["create"],
                columns: [
                            { field: "PROJECT_ID", title: "ID" },
                            { field: "PROJECT_NM", title: "Name" },
                            { field: "PROJECT_DESC", title: "Description" },
                            { field: "ACTIVE_IND", title: "Active" },
                            { command: ["edit"], title: " "}],
                editable: "popup",
                save: function (e) {

                    var g = $("#grid").data("kendoGrid");
                    var ds = g.dataSource;

                    var refresh = false;
                    //alert(kendo.stringify(e.model));
                    var url = "";
                    e.model.ACTIVE_IND = e.model.ACTIVE_IND ? 1 : 0
                         $.ajax({
                        url: url,
                        data: kendo.stringify(e.model),
                        type: 'POST',
                        processData: true,
                        async: false,
                        contentType: "application/json",
                        success: function (data, textStatus, jqXHR) {
                                    alert("Updated")  

                        },
                        error: function (xhr, status, error) {
                            alert("Failed to Update");
                        }
                    });

                }
            });

 

Alexander Valchev
Telerik team
 answered on 16 May 2012
1 answer
167 views
It seems that in the current implementation of MVVM:

  • A dependent property (calculated field) can easily use the value of another property of the view Model through the this.get(propertyName) syntax.
  • However, a new calculated field can't seem to utilize another property of the view Model IF THAT PROPERTY is ITSELF a Calculated Field.
Can someone confirm this for me or can someone tell me the way around.

See this JSFiddle for a demonstration

In the addNew() method.  I'm just trying to display the value of this.get("displayDropDownValue") which is, a calculated field.  It seems the only way to get this to work properly is to REPLICATE all of the code inside the displayDropDownValue field and put it in the new addNew() method as well.

Any suggestions?  Help?

Atanas Korchev
Telerik team
 answered on 16 May 2012
0 answers
147 views
Hello

I'm quite newbie. I don't understand what is my problem exactly.
Following is my code.
$("#cmbCompany").width(350).kendoComboBox({
        placeholder: "Select company",
        serverFiltering: true,
        dataTextField: "Company",
        dataValueField: "ClientNo",
        dataSource: {
            transport: {
                read: "/Admin/GetAllCompany"
            }
        },
        change: function () {
            var value = this.value();
            if (value) {
                employeeDataSource.query({ companyNo: value });
                employee.enable();
            } else {
                employee.enable(false);
            }
 
          employee.value("");
        }
    });
     
    var employeeDataSource = new kendo.data.DataSource({
        transport: {
          dataType: "json",
          read: "/Admin/GetEmployeesByCompany"
        }
    });
 
    var employee = $("#cmbEmployee").width(300).kendoComboBox({
        autoBind: false,
        placeholder: "Select employee",
        dataTextField: "Name",
        dataValueField: "Email",
        dataSource: employeeDataSource
    }).data("kendoComboBox");

First time I select #cmbCompany combo box, it load data and shows propely at #cmbEmployee.
But second time, I select a new value at #cmbCompanyasd , it works nothing.
It did nothing, even not send http request.

How can I work it properly?

Thank you in advance.

ShootingStar
Top achievements
Rank 1
 asked on 16 May 2012
0 answers
213 views
I need change culture datepicker is th-TH but i want call kendoDatePicker all file i use widget-style="kendoDatePicker" but it doesn't work  
please help me I'm sorry i can type Eng a little bit



example
widget.js
$(document).ready(function() {
kendo.culture (th-TH);
 $(".kendoDatePicker").kendoDatePicker({
    format: (kendo.culture().calendar.patterns.d)
         
         });
});



XML_FORM.xml
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
    <!-- Invoice forms -->
    <form name="FindInvoices" type="single" target="findInvoices" title="Find and list invoices"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="noConditionFind"><hidden value="Y"/><!-- if this isn't there then with all fields empty no query will be done
--></field>
        <field name="hideSearch"><hidden value="Y"/></field>
        <field position="1" name="invoiceId" title="${uiLabelMap.iMAS_PurchaseCashInvoiceId}" widget-style="k-textbox"><lookup target-form-name="LookupCashPurchaseInvoice" size="15"/><!--text-find default-option="contains" ignore-case="true"/--></field>
        <field position="2" name="orderId" title="${uiLabelMap.iMAS_PurchaseCashOrderId}" widget-style="k-textbox"><lookup target-form-name="LookupOrderHeaderPurchase" size="15"/></field>
        <field position="1" name="partyIdFrom" parameter-name="partyId" title="${uiLabelMap.iMAS_PurchaseInvoiceSupplier}" widget-style="k-textbox"><lookup target-form-name="LookupSupplier" size="15"/></field>
        <field position="2" name="invoiceDate" title="${uiLabelMap.iMAS_PurchaseCashInvoiceDate}" widget-style="kendoDatePicker"><text default-value="${nowDateTime}"/></field>
        <field position="2" name="statusId" title="${uiLabelMap.CommonStatus}" widget-style="kendoDropDownList">
            <drop-down allow-empty="true" current="first-in-list" >
                <entity-options description="${description}" entity-name="StatusItem">
                    <entity-constraint name="statusTypeId" operator="equals" value="INVOICE_STATUS"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="invoiceTypeId">
            <hidden value="CASH_PURCHASE_INVOICE"/>
        </field>
    </form>
AL
Top achievements
Rank 1
 asked on 16 May 2012
3 answers
586 views
Only certain TreeView nodes can be selected, and using enabled: false; does not allow the expand to function.

How is it possible to only select tree nodes with no parents?  This means their parent node cannot be selected.  Can the select event be canceled?
Alex Gyoshev
Telerik team
 answered on 16 May 2012
1 answer
178 views
Hello

I have a problem panel bar with Twitter bootstrap.

I want to put two combo box in one line an the first PanelBar tab.

My code is exactly same as following link.
http://jsfiddle.net/nxhPW/3/

It is broken the shape when I set class="span5" << twitter bootstrap css property (set width)

How can I this broken panel box fix?

Could you help me a little?

Thank you in advance.
Kamen Bundev
Telerik team
 answered on 16 May 2012
0 answers
95 views
How to set the size of the Dropdown List box as well as list of its options size to auto. The drop down should automatically increase in size like a normal HTML DropDown. How can I achieve this?
Brahmaiah
Top achievements
Rank 1
 asked on 15 May 2012
0 answers
89 views
hello
may declare when columns of this type
columns: [
                          { field: "FirstName", title: "productos", format: "{0:c}", type:"String",editable: false, width: "150px" },
                           { field: "City", title: "cantidad", editable:true, type:"Number", validation: { min: 1, required: true },width: "150px" },
                           {field: "BirthDate", title: "fecha de Entrega",type:"String",editable:true,width:"150px"},
                           { field: "favoritos", title: "favoritos", editable:true, type:"String",width: "150px" },
                           {field: "boton", template: "#=  '<form id=\"form3\" method=\"post\" action=\"prueba9.asp\"><input type=\"text\" name=\"nombre\"id=\"<-------------------here\"><input type=\"text\" name=\"apellido\" id=\"<------------------here\"><input type=\"button\" id=\"boton3\"class=\"boton3\"value=\"Enviar\" onclick=\"document.form3.nomb.value=documen t.form3.nomb.value;document.form3.favo.value=document.form3.favo.value;submit();\"></form>' #", title: "favorito", width: "100px",type:"String", editable:false },                        
                           { field: "añadir", template: "#= '<input type=IMAGE SRC=\"add.gif\"\id=\"añadir\" value=\"CODE\" />' #", title: "añadir", width: "210px",type:"String", editable:false }],


can add a variable to increase and give me id different <input>?
and if so how to do?

regards!!
Ricardo
Top achievements
Rank 1
 asked on 15 May 2012
3 answers
108 views
<div data-role="rangeslider" data-bind="value: Capacity, events: {change: editCapacity}" data-max="20">                   
                            <input />
                            <input />
                        </div>

//From the model
editCapacity: function (site) {
            saveCapacity(site);
        }


function saveCapacity(site){
    var data =
            { "id": viewModel.BlockID ,
                "campusid": viewModel.selectedCampus.get("CampusID"),
                "rotationid": viewModel.selectedRotation.get("RotationID"),
                "siteid": site.data.get("SiteID"),
                "min": site.data.get("Capacity")[0],
                "max": site.data.get("Capacity")[1]
            };
 
    $.ajax({
        url: "/api/cps/clerkship/blocks/" + viewModel.BlockID + "/editcapacity",
        type: "PUT",
        data: data,
    }).done(function () {
         
    });
}

So let say the values initally are 0, 10.  If I change the slider to 0, 5, this function triggers, but the Capacity value is still 0,10.  The 0,5 is set after this finishes running.
Rosen
Telerik team
 answered on 15 May 2012
4 answers
127 views
I have click events on elements to set a model "selectedItem" value (initialized as null, but set on click...)

Can I somehow data-bind a window to do the editing of those selected values?  Do you know what I mean...popup editing of an "Item"?

Nothing I try seems to work at all :/ ...so is it even possible?

viewModel = kendo.observable({
        selectedItem: null,
        editItem: function (item) {
           selectedItem = item;
      }
});

Also when I set the data-role on the window to be "window" can I not still get a reference to it with $("#window).data("kendoWindow") to get\change values?  Seems to keep being "undefined" for me.

Thanks,
Steve
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 15 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?